problem with RectangleSelector

Hello list,

I'm encountering a strange problem with the RectangleSelector using the latest
version of svn. Namely it doesn't work if it wasn't initialized as
RS = RectangleSelector(...)
but using
RectangleSelector(...)
in my script.

I modified the example rectangle_selector.py from the folder examples/widgets
to illustrate my observation.

Can anybody reproduce my findings or even explain what is going on?

Thanks in advance for any comments.

Kind regards,
Matthias

rectangle_selector.py (2.04 KB)

Hello list,

I'm encountering a strange problem with the RectangleSelector using the latest
version of svn. Namely it doesn't work if it wasn't initialized as
RS = RectangleSelector(...)
but using
RectangleSelector(...)
in my script.

I modified the example rectangle_selector.py from the folder examples/widgets
to illustrate my observation.

Can anybody reproduce my findings or even explain what is going on?

If you don't keep a reference to the RectangleSelector object, it vanishes--it is garbage-collected.

Eric

···

On 06/21/2010 06:10 AM, Matthias Michler wrote:

Thanks in advance for any comments.

Kind regards,
Matthias

Hi Eric,

thanks for your reply. That sounds reasonable, but I'm still confused. With
the matplotlib release 0.99.1.1 the RectangleSelector works with and without a
reference to it. Was this old behavior somehow unintended?

Kind regards,
Matthias

···

On Monday, June 21, 2010 06:30:04 pm Eric Firing wrote:

On 06/21/2010 06:10 AM, Matthias Michler wrote:
> Hello list,
>
> I'm encountering a strange problem with the RectangleSelector using the
> latest version of svn. Namely it doesn't work if it wasn't initialized
> as RS = RectangleSelector(...)
> but using
> RectangleSelector(...)
> in my script.
>
> I modified the example rectangle_selector.py from the folder
> examples/widgets to illustrate my observation.
>
> Can anybody reproduce my findings or even explain what is going on?

If you don't keep a reference to the RectangleSelector object, it
vanishes--it is garbage-collected.

Eric

Hello list,

I'm encountering a strange problem with the RectangleSelector using the
latest version of svn. Namely it doesn't work if it wasn't initialized
as RS = RectangleSelector(...)
but using
RectangleSelector(...)
in my script.

I modified the example rectangle_selector.py from the folder
examples/widgets to illustrate my observation.

Can anybody reproduce my findings or even explain what is going on?

If you don't keep a reference to the RectangleSelector object, it
vanishes--it is garbage-collected.

Eric

Hi Eric,

thanks for your reply. That sounds reasonable, but I'm still confused. With
the matplotlib release 0.99.1.1 the RectangleSelector works with and without a
reference to it. Was this old behavior somehow unintended?

I don't know. In both cases, are you trying it in a script, and running it outside ipython? Ipython keeps references to inputs and outputs.

There haven't been many changes to widgets.py, and I don't see anything that could account for the difference. I also don't see what could keep it alive if you don't keep a reference to it.

If the same externally-run script works differently in this respect between the two mpl versions, then I'm baffled.

Eric

···

On 06/21/2010 09:28 PM, Matthias Michler wrote:

On Monday, June 21, 2010 06:30:04 pm Eric Firing wrote:

On 06/21/2010 06:10 AM, Matthias Michler wrote:

Kind regards,
Matthias

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

>>> Hello list,
>>>
>>> I'm encountering a strange problem with the RectangleSelector using the
>>> latest version of svn. Namely it doesn't work if it wasn't initialized
>>> as RS = RectangleSelector(...)
>>> but using
>>> RectangleSelector(...)
>>> in my script.
>>>
>>> I modified the example rectangle_selector.py from the folder
>>> examples/widgets to illustrate my observation.
>>>
>>> Can anybody reproduce my findings or even explain what is going on?
>>
>> If you don't keep a reference to the RectangleSelector object, it
>> vanishes--it is garbage-collected.
>>
>> Eric
>
> Hi Eric,
>
> thanks for your reply. That sounds reasonable, but I'm still confused.
> With the matplotlib release 0.99.1.1 the RectangleSelector works with
> and without a reference to it. Was this old behavior somehow unintended?

Hi Eric,

I don't know. In both cases, are you trying it in a script, and running
it outside ipython? Ipython keeps references to inputs and outputs.

yes I'm just using

python rectangle_selector.py

with the slightly modified script I have sent last time for matplotlib-svn and
additionally comment out the 'button' - keyword argument for the release
0.99.1.1. The only difference between the two runs is whether matplotlib-svn is
found in the PYTHONPATH or not.

There haven't been many changes to widgets.py, and I don't see anything
that could account for the difference I also don't see what could keep
it alive if you don't keep a reference to it.

If the same externally-run script works differently in this respect
between the two mpl versions, then I'm baffled.

I'm baffled, too. That was what made starting this thread and hope for an
explanation, what I'm doing wrong.

Kind regards,
Matthias

···

On Tuesday, June 22, 2010 10:03:06 am Eric Firing wrote:

On 06/21/2010 09:28 PM, Matthias Michler wrote:
> On Monday, June 21, 2010 06:30:04 pm Eric Firing wrote:
>> On 06/21/2010 06:10 AM, Matthias Michler wrote:

I could have sworn that there was a bug fix a month or two ago dealing with what appeared to be a memory leak of some sort. It seemed that some stuff was not getting garbage-collected because they weren’t completely dereferenced. I seem to recall that it had something to do with various backend action callbacks not being dis-connected when finished (or the action was being connected too many times).

Maybe that might explain the difference in behavior (that is, that the old behavior was a “bug” not a “feature”)?

Ben Root

···

On Tue, Jun 22, 2010 at 3:45 AM, Matthias Michler <MatthiasMichler@…361…> wrote:

On Tuesday, June 22, 2010 10:03:06 am Eric Firing wrote:

On 06/21/2010 09:28 PM, Matthias Michler wrote:

On Monday, June 21, 2010 06:30:04 pm Eric Firing wrote:

On 06/21/2010 06:10 AM, Matthias Michler wrote:

Hello list,

I’m encountering a strange problem with the RectangleSelector using the

latest version of svn. Namely it doesn’t work if it wasn’t initialized

as RS = RectangleSelector(…)

but using

RectangleSelector(…)

in my script.

I modified the example rectangle_selector.py from the folder

examples/widgets to illustrate my observation.

Can anybody reproduce my findings or even explain what is going on?

If you don’t keep a reference to the RectangleSelector object, it

vanishes–it is garbage-collected.

Eric

Hi Eric,

thanks for your reply. That sounds reasonable, but I’m still confused.

With the matplotlib release 0.99.1.1 the RectangleSelector works with

and without a reference to it. Was this old behavior somehow unintended?

Hi Eric,

I don’t know. In both cases, are you trying it in a script, and running

it outside ipython? Ipython keeps references to inputs and outputs.

yes I’m just using

python rectangle_selector.py

with the slightly modified script I have sent last time for matplotlib-svn and

additionally comment out the ‘button’ - keyword argument for the release

0.99.1.1. The only difference between the two runs is whether matplotlib-svn is

found in the PYTHONPATH or not.

There haven’t been many changes to widgets.py, and I don’t see anything

that could account for the difference I also don’t see what could keep

it alive if you don’t keep a reference to it.

If the same externally-run script works differently in this respect

between the two mpl versions, then I’m baffled.

I’m baffled, too. That was what made starting this thread and hope for an

explanation, what I’m doing wrong.

Kind regards,

Matthias

Yes, precisely.

Mike

···
-- Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA