gcf() problem

Hi all,
I have a little problem, I've been unable to solve, maybe someone can help
me out.
I have several figures opened, but when I use gcf() I get handle of the last
opened figure instead of the active one...
i.e. when intercepting a button_press_event, gcf().number returns the number
of the last figure, not the number of the figure over which I clicked
(different from last one).

How can I force that the gcf() to return handle to the active figure?
Is there any event trigered when a figure gets the focus?
I don't think this should be the normal behaviour, but I have review my code
and I haven't found how could I be forcing this... any idea about how to
debug this? or if this is a bug?

some data that may help:
matplotlib version 0.98.1
interactive is True
units is False
platform is win32
numerix numpy 1.1.0
backend TkAgg version 8.4

···

--
View this message in context: http://www.nabble.com/gcf()-problem-tp18184245p18184245.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

gcf is written to return the last figure activated or created by the
"figure" command. It would be fairly trivial to add support for
making the last clicked figure the active one, but it seems like a
reasonable thing to do (does anyone know what matlab does?). Since
gcf emulates a matlab function, I'd like to hew fairly closely to
that.

JDH

···

On Sun, Jun 29, 2008 at 2:09 PM, sordnay <sordnay@...287...> wrote:

Hi all,
I have a little problem, I've been unable to solve, maybe someone can help
me out.
I have several figures opened, but when I use gcf() I get handle of the last
opened figure instead of the active one...
i.e. when intercepting a button_press_event, gcf().number returns the number
of the last figure, not the number of the figure over which I clicked
(different from last one

in Matlab, gcf() returns a handle to the last activated figure, either
by click or programmatically (e.g. "figure(1)", etc)

Cheers,
Vincent

···

On Sun, Jun 29, 2008 at 22:26, John Hunter <jdh2358@...287...> wrote:

gcf is written to return the last figure activated or created by the
"figure" command. It would be fairly trivial to add support for
making the last clicked figure the active one, but it seems like a
reasonable thing to do (does anyone know what matlab does?). Since
gcf emulates a matlab function, I'd like to hew fairly closely to
that.

OK, then it's a bug. Could you file a bug report on the sf bug tracker

since I don't have time to fix this right now but don't want to forget about it?

Thanks,
JDH

···

On Sun, Jun 29, 2008 at 3:40 PM, Vincent Noel <vincent.noel@...287...> wrote:

in Matlab, gcf() returns a handle to the last activated figure, either
by click or programmatically (e.g. "figure(1)", etc)

I've submited the bug,
I also tried to think about a solution, but this is not trivial at all for
me hehe, I'm still learning how to use this wonderful piece of software
(thank you all who did developed it btw)
I think figure should simply call

_pylab_helpers.Gcf.set_active(figManager)

whenever a figure is clicked, but I just don't now how or where a figure
"knows" that it's been clicked.

John Hunter-4 wrote:

···

On Sun, Jun 29, 2008 at 3:40 PM, Vincent Noel <vincent.noel@...287...> > wrote:

in Matlab, gcf() returns a handle to the last activated figure, either
by click or programmatically (e.g. "figure(1)", etc)

OK, then it's a bug. Could you file a bug report on the sf bug tracker

matplotlib download | SourceForge.net

since I don't have time to fix this right now but don't want to forget
about it?

Thanks,
JDH

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
View this message in context: http://www.nabble.com/gcf()-problem-tp18184245p18221506.html
Sent from the matplotlib - users mailing list archive at Nabble.com.