Hello darkside, I tried your example and it works for me (with mpl-svn) using GTKAgg and doesn't work (like you reported) using TKAgg (Is this a bug?). Maybe you can switch to GTKAgg? Otherwise you should report the mpl-version you are using. >------------------------------------- import matplotlib #matplotlib.use("TKAgg") matplotlib.use("GTKAgg") import pylab >---------------------------------------
best regards, Matthias On Thursday 28 June 2007 19:39, darkside wrote: > Hello everyone, > I'm trying to do a program that opens two different plots and select one > point of each one with a mouse event. Here you have my example: > > > -------------------------- > import pylab > > def click(event): > global x # allow to change global variable > if event.button == 1: > if event.inaxes: > x = event.xdata # change global variable > print " x - intern = ", x > pylab.disconnect(cid) > pylab.close() > return x > > xlist = [] # list for x values > global x > #for i in xrange(4): > fig = pylab.figure() > ax = fig.add_subplot(111) > pylab.title('primera') > cid = pylab.connect('button_press_event', click) > pylab.show() > print " x - extern = ", x > xlist.append(x) > pylab.close() > > fig = pylab.figure() > > ax = fig.add_subplot(111) > pylab.title('segunda') > cid = pylab.connect('button_press_event', click) > pylab.show() > print " x - extern = ", x > xlist.append(x) > pylab.close() > -------------------------------------------------- > The problem is that the click event only works with the first plot, in the > second one I get the plot, but not the mouse event. So my output is: > x - intern = 0.696277915633 > x - extern = 0.696277915633 > x - extern = 0.696277915633 > As you see, I only get the x-intern once. > > Does anybody know what I'm doing wrong? ------------------------------------------------------------------------- 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users