RectangleSelector on demand

Hello,
I am trying to use the RectangleSelector widget.
In the corresponding example
http://matplotlib.sourceforge.net/examples/widgets/rectangle_selector.html

the rectangle selector is activated every time I click inside the axes.
However, I would like to activate it on demand.
For example, suppose there is a choice-box (using a simple gui like easygui).
One of the possible choices would be “select rectangle”.

I would like the RectangleSelector to be activated only after the “select rectangle” option is chosen and deactivated after one rectangle selection.
It should be activated again only after the choice-menu is presented again and the “selected rectangle” option is chosen again.

The MATLAB equivalent to what I need is the command rbbox
http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/rbbox.html

It can be activated on demand, in a norma “linear” program and not just in event-driven GUI.
Is there a way to get the same functionality from matplotlib ?

Thanks
Eli

Hi Eli,

I'm not sure I understood correctly, but maybe the attached example from the
docsting of the RectangleSelector helps you.
A kind of a choice-box is 'RadioButtons', whose usage is explained in the
slider_demo.py

kind regards,
Matthias

docstring_RectangleSelector.py (918 Bytes)

···

On Thursday 13 August 2009 04:05:09 Eli Brosh wrote:

Hello,
I am trying to use the RectangleSelector widget.
In the corresponding example
http://matplotlib.sourceforge.net/examples/widgets/rectangle_selector.html
the rectangle selector is activated every time I click inside the axes.
However, I would like to activate it on demand.
For example, suppose there is a choice-box (using a simple gui like
easygui).
One of the possible choices would be "select rectangle".
I would like the RectangleSelector to be activated only after the "select
rectangle" option is chosen and deactivated after one rectangle selection.
It should be activated again only after the choice-menu is presented again
and the "selected rectangle" option is chosen again.

The MATLAB equivalent to what I need is the command rbbox
MATLAB Documentation
lpdesk/help/techdoc/ref/rbbox.html It can be activated on demand, in a norma
"linear" program and not just in event-driven GUI.
Is there a way to get the same functionality from matplotlib ?

Thanks
Eli