getting a subregion with the cursor

I would like to be able to call something like:

sub = getSub(myImage)

and then click my cursor on two places in an image and have that subregion
returned as sub. I would also like to be able to do this with a single
statement rather doing z=connect('button_press_event',getSub). Seems like
something like this should be around.

thanks,

Ken

The RectangleSelector provides something close to this functionality
-- check out http://matplotlib.sourceforge.net/examples/widgets/rectangle_selector.py

ยทยทยท

On Wed, Jul 16, 2008 at 7:36 AM, Ken Dere <kdere@...1417...> wrote:

I would like to be able to call something like:

sub = getSub(myImage)

and then click my cursor on two places in an image and have that subregion
returned as sub. I would also like to be able to do this with a single
statement rather doing z=connect('button_press_event',getSub). Seems like
something like this should be around.