From: Brian T.N. G. <gu...@ll...> - 2007-06-26 23:15:48
|
I have a matplotlib script that generates several figures. When a figure receives an event, how do I know which figure it did it? For example, the key event 'w' is meant to close the figure, but so far, I have no way to control which figure gets closed. In the pick_event_demo.py example, each figure is connected to an event handler specific to it. I think this wouldn't work in my case because I don't know how many figures I'd have until I process some data. In any case, all my event handlers can be independent of the figure generating the event. They just need to know which figure to refer to. My work-around right now is to save the canvas attributes from all the figure handle. I compare this canvas to the canvas attribute of the event. When I found a match, I know I have the right figure. This seems kludgey, especially after most of the figures have been closed. I'd appreciate any help or pointers. Brian |