catching close figure event

Hello everybody,

I would like to call a function when I close manually a window previously opened by a pylab.figure. I tried the following:

f = pylab.figure()
f.canvas.mpl_connect(‘close_event’,my_function)

but it fails because the ‘close_event’ is not recognized as a valid event (button_press_event, axis_leave_event …). Would you have any idea ?

thank you very much

regards

Eric Pellegrini

Eric,

Which version of matplotlib are you using? “close_event” is a valid event identifier.

Ben Root

···

On Thu, Jul 29, 2010 at 12:18 PM, Pellegrini Eric <ericpellegrini@…136…> wrote:

Hello everybody,

I would like to call a function when I close manually a window previously opened by a pylab.figure. I tried the following:

f = pylab.figure()
f.canvas.mpl_connect(‘close_event’,my_function)

but it fails because the ‘close_event’ is not recognized as a valid event (button_press_event, axis_leave_event …). Would you have any idea ?

thank you very much

regards

Eric Pellegrini

It was added in the most recent 1.0, so make sure you have that.

Ryan

···

On Thu, Jul 29, 2010 at 12:26 PM, Benjamin Root <ben.root@…3203…04…> wrote:

On Thu, Jul 29, 2010 at 12:18 PM, Pellegrini Eric <ericpellegrini@…136…> wrote:

Hello everybody,

I would like to call a function when I close manually a window previously opened by a pylab.figure. I tried the following:

f = pylab.figure()
f.canvas.mpl_connect(‘close_event’,my_function)

but it fails because the ‘close_event’ is not recognized as a valid event (button_press_event, axis_leave_event …). Would you have any idea ?

thank you very much

Eric,

Which version of matplotlib are you using? “close_event” is a valid event identifier.


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Hi Ben,
I use the version 0.99.3.
Eric
— En date de : Jeu 29.7.10, Benjamin Root <ben.root@…1304…> a écrit :

···

De: Benjamin Root <ben.root@…1304…>
Objet: Re: [Matplotlib-users] catching close figure event
À: “Pellegrini Eric” <ericpellegrini@…136…>
Cc: matplotlib-users@lists.sourceforge.net
Date: Jeudi 29 juillet 2010, 19h26

On Thu, Jul 29, 2010 at 12:18 PM, Pellegrini Eric <ericpellegrini@…136…> wrote:

Hello everybody,

I would like to call a function when I close manually a window previously opened by a pylab.figure. I tried the following:

f = pylab.figure()
f.canvas.mpl_connect(‘close_event’,my_function)

but it fails because the ‘close_event’ is not recognized as a valid event (button_press_event, axis_leave_event …). Would you have any idea ?

thank you very much

regards

Eric Pellegrini

Eric,

Which version of matplotlib are you using? “close_event” is a valid event identifier.

Ben Root

Hi Ryan,
bad luck, I use the version 0.99.3 … and currently I must keep on using it …
Would you see another way to proceed from matplotlib ?
thanks
Eric
— En date de : Jeu 29.7.10, Ryan May <rmay31@…287…> a écrit :

···

De: Ryan May <rmay31@…287…>
Objet: Re: [Matplotlib-users] catching close figure event
À: “Pellegrini Eric” <ericpellegrini@…136…>
Cc: “Benjamin Root” <ben.root@…1304…>, matplotlib-users@…504…et
Date: Jeudi 29 juillet 2010, 19h29

On Thu, Jul 29, 2010 at 12:26 PM, Benjamin Root <ben.root@…120…1304…> wrote:

On Thu, Jul 29, 2010 at 12:18 PM, Pellegrini Eric <ericpellegrini@…136…> wrote:

Hello everybody,

I would like to call a function when I close manually a window previously opened by a pylab.figure. I tried the following:

f = pylab.figure()
f.canvas.mpl_connect(‘close_event’,my_function)

but it fails because the ‘close_event’ is not recognized as a valid event (button_press_event, axis_leave_event …). Would you have any idea ?

thank you very much

Eric,

Which version of matplotlib are you using? “close_event” is a valid event identifier.

It was added in the most recent 1.0, so make sure you have that.

Ryan


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma