Hi, I have a "simple" problem with mpl, but didn't find a way to solve it so far. Let's say I have a set of three 2Darrays I would like to :
- load using imshow - then connect to the mouse click event and add all X and Y coordinates obtained when clicking (so each time I click, I'll get xc += event.x for example) and PAUSE the program until I get a click on the right button of the mouse - when I click on the right button of the mouse, I want the program to go on and load the second data array - ... and continue until all data arrays have been looked at in that way. So in principle it would look like the script below. But of course this DOES NOT WORK!!! So I would welcome any suggestion of how to solve this problem.... Eric ================= import numpy as num class offset: def __init__(self) : self.xc = 0. self.yc = 0. self.stay = 1 def on_click(self, event) : if event.button == 1: if event.inaxes is not None: self.xc += event.xdata self.yc += event.ydata elif event.button == 3: self.stay = 0 data1 = num.random.rand(10,10) data2 = num.random.rand(10,10) data3 = num.random.rand(10,10) alldata = [data1, data2, data3] for i in range(len(alldata)) : imshow(alldata[i]) newoffset = offset() binding = connect('button_press_event', newoffset.on_click) while newoffset.stay : pass disconnect(binding) print newoffset.xc, newoffset.yc ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users