On 6/26/07, Brian T.N. Gunney <[EMAIL PROTECTED]> wrote:
> 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.

All events are connected to figures by definition -- the figure is
placed inside a GUI canvas and that is what manages the events.  The
pylab connect function is just a thing wrapper to the canvas
mpl_connection function.  pylab's connect just grabs the current
figure with "gcf" and makes the call fig.canvas.mpl_connect

So in matplotlib, events do not make since w/o reference to specific figures.


> 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.

I don't see why this is a problem -- just set up the connections when
you create the figure as you process the data.  You'll probably need
to post an example if you have further troubles, because it is hard to
advise in the abstract.

JDH

-------------------------------------------------------------------------
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

Reply via email to