Matplotlib and mouse events
Tommy Grav
tgrav at mac.com
Tue Jul 18 00:03:47 EDT 2006
I am trying to use matplotlib to display two images and then by mouse
click
identify a source in each image. The setup is as follows
figim = figure(figsize=(8,4))
axsrc24 = figim.add_subplot(121, xlim=(0,200), ylim=(0,200),
autoscale_on=False)
axsrc24.set_title('Click to zoom')
axsrc70 = figim.add_subplot(122, xlim=(0,100), ylim=(0,100),
autoscale_on=False)
axsrc70.set_title('Click to zoom')
def clicker(event):
if event.inaxes == axsrc24:
print 'you clicked on the 24 micron image'
if event.inaxes == axsrc70:
print 'you clicked on the 70 micron image'
return
figim.canvas.mpl_connect("button_press_event",clicker)
Now I want to only be able to click each subplot once then lock that
subplot
(making it unclickable) and also close the figure when both images
have been
clicked on, but I am stuck on implementing this. Anyone have any
suggestions.
I am using the TkAgg interface on a Mac.
Cheers
Tommy
tgrav at mac.com
http://homepage.mac.com/tgrav/
"Any intelligent fool can make things bigger,
more complex, and more violent. It takes a
touch of genious -- and a lot of courage --
to move in the opposite direction"
-- Albert Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060718/2d9c7fa6/attachment.html>
More information about the Python-list
mailing list