Convert tuple to a string
<p>I know tuple to string questions were asked before but i dont really get it the way they explain it so I try to get an explanation on my example.
So i need to convert the tuple points to a string to fill it in in the last line after 'got data'.
This is the script:</p>

<pre><code>def on_pick(self, event):

    print('On Pick!')

    thisline = event.artist
    xdata = thisline.get_xdata()
    ydata = thisline.get_ydata()
    ind = event.ind
    print(ind)

    points = tuple(zip(xdata[ind], ydata[ind]))
    print('onpick points:', points)

    QtGui.QMessageBox.information(self, "Click!", 'got data' + points)
</code></pre>

<p>the call is </p>

<pre><code>self.canvas.mpl_connect('pick_event', self.on_pick)
</code></pre>

<p>and the output shoul be this as i already described it:</p>

<pre><code>QtGui.QMessageBox.information(self, "Click!", 'got data' + points)
</code></pre>

<p>So where points is written in the last line i want to fill in the string of the tuple points.
Im new to python so dont hate me :D</p>

<p>How about </p>

<pre><code>myString = "got data %s, %s" % (str(xdata),str(ydata))
QtGui.QMessageBox.information(self, "Click!", myString)
</code></pre>

<p>or if xdata is a tuple</p>

<pre><code>myString = "got data %s, %s" % (str(xdata[0]),str(xdata[1]))

a = (1,2)
b = "asdf %s %s" % (str(a[0]),str(a[1]))
</code></pre>

python string tuples