Hello darkside,
maybe the following little examples helps you with disconnecting:
>--------------------------------------------------------------------------------
from pylab import *
def event_response(event):
print event.name
disconnect(cid)
subplot(111)
cid = connect('button_press_event', event_response)
show()
>-----------------------------------------------------------------------------
concerning opening of figures:
I think it is not possible to open a figure after the show()
( I asked some time ago with subject "open / close or set active figures
during mainloop", but unfortunately without response).
Maybe it would be sufficient for you to clean the figure or the axes
(pylab.clf/cla), resetting labels and use the same connected event several
times.
best regards,
Matthias
On Monday 04 June 2007 04:28, darkside wrote:
> I'm trying to use matplotlib to get an x point on some figures by mouse
> clicking.
> To do this I try the next example:
> -------------------------
> datax=[]
> datay =[]
> def click(event):
> x, y = event.x, event.y
> if event.button == 1:
> if event.inaxes:
> print 'data coords: ', event.xdata, event.ydata
> datax.append(event.xdata)
> datay.append(event.ydata)
> if event.button == 3:
> pylab.close()
> return datax,datay
> fig = pylab.figure(figsize=(8,6))
> ax = fig.add_subplot(111)
>
> - Ignored:
> ax.plot(pylab.arange(10))
> cursor = Cursor(ax, useblit=False, color='red', linewidth=2)
> cursor.horizOn = False
>
> pylab.connect('button_press_event', click)
>
> pylab.show()
> pylab.disconnect(click)
> print 'los arrays de data son: ', datax,datay
> ------------------------------------------------------
>
> My problem is tha I want to only be able to click each figure once, then
> lock the
> figure (making it unclickable), close it and open another one. But I'm
> not
> able to
> implement this.
> Anyone have any suggestions?.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users