I noticed on the event handling doc page:
matplotlib-devel@lists.sourceforge.net
that the draggable rectangle example doesn't work in version 0.98.3.
The rectangle class no longer seems to have the xy property. If you
replace the current on_press() method in the example with the code
below it seem to work.
def on_press(self, event):
'on button press we will see if the mouse is over us and store
some data'
if event.inaxes != self.rect.axes: return
contains, attrd = self.rect.contains(event)
if not contains: return
xy = self.rect.get_x(),self.rect.get_y()
print 'event contains', xy
x0, y0 = xy
self.press = x0, y0, event.xdata, event.ydata
Neil
Neil Crighton wrote:
I noticed on the event handling doc page:
matplotlib-devel@lists.sourceforge.net
that the draggable rectangle example doesn't work in version 0.98.3.
The rectangle class no longer seems to have the xy property. If you
replace the current on_press() method in the example with the code
below it seem to work.
def on_press(self, event):
'on button press we will see if the mouse is over us and store
some data'
if event.inaxes != self.rect.axes: return
contains, attrd = self.rect.contains(event)
if not contains: return
xy = self.rect.get_x(),self.rect.get_y()
print 'event contains', xy
x0, y0 = xy
self.press = x0, y0, event.xdata, event.ydata
Good catch. I checked in a slightly different version of the fix.
Ryan
···
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Neil Crighton wrote:
I noticed on the event handling doc page:
matplotlib-devel@lists.sourceforge.net
that the draggable rectangle example doesn't work in version 0.98.3.
The rectangle class no longer seems to have the xy property. If you
replace the current on_press() method in the example with the code
below it seem to work.
def on_press(self, event):
'on button press we will see if the mouse is over us and store
some data'
if event.inaxes != self.rect.axes: return
contains, attrd = self.rect.contains(event)
if not contains: return
xy = self.rect.get_x(),self.rect.get_y()
print 'event contains', xy
x0, y0 = xy
self.press = x0, y0, event.xdata, event.ydata
Here's probably a better question to ask than just to fix the example.
Was it intended that the Rectangle.xy attribute disappear? I couldn't
find it documented in API_CHANGES. It appears that there was just a
change at some point in Michael's transforms work. If it's considered
desirable to have it back, I'll volunteer to whip up a patch to make it
a property. If not, let's just make sure we document this in API_CHANGES.
My opinion is that randomly breaking API is always bad, and there's not
much effort involved in fixing it here. On the other hand, we've
already had 3 with this breakage, and no complaints up until now (and
that's from our own docs :P)
Thoughts?
Ryan
···
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
I have no problem with you adding it back in as a convenience
property. Can't see the harm.
JDH
···
On Wed, Oct 29, 2008 at 4:00 PM, Ryan May <rmay31@...149...> wrote:
Here's probably a better question to ask than just to fix the example.
Was it intended that the Rectangle.xy attribute disappear? I couldn't
find it documented in API_CHANGES. It appears that there was just a
change at some point in Michael's transforms work. If it's considered
desirable to have it back, I'll volunteer to whip up a patch to make it
a property. If not, let's just make sure we document this in API_CHANGES.
Agreed. I think it is missing only be accident.
Mike
John Hunter wrote:
···
On Wed, Oct 29, 2008 at 4:00 PM, Ryan May <rmay31@...149...> wrote:
Here's probably a better question to ask than just to fix the example.
Was it intended that the Rectangle.xy attribute disappear? I couldn't
find it documented in API_CHANGES. It appears that there was just a
change at some point in Michael's transforms work. If it's considered
desirable to have it back, I'll volunteer to whip up a patch to make it
a property. If not, let's just make sure we document this in API_CHANGES.
I have no problem with you adding it back in as a convenience
property. Can't see the harm.
JDH
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
Thanks - sorry for posting the mailing list address instead of the the
event handling page(!). That'll teach me to email before
proof-reading...
2008/10/29 Ryan May <rmay31@...149...>:
···
Neil Crighton wrote:
I noticed on the event handling doc page:
matplotlib-devel@lists.sourceforge.net
that the draggable rectangle example doesn't work in version 0.98.3.
The rectangle class no longer seems to have the xy property. If you
replace the current on_press() method in the example with the code
below it seem to work.
def on_press(self, event):
'on button press we will see if the mouse is over us and store
some data'
if event.inaxes != self.rect.axes: return
contains, attrd = self.rect.contains(event)
if not contains: return
xy = self.rect.get_x(),self.rect.get_y()
print 'event contains', xy
x0, y0 = xy
self.press = x0, y0, event.xdata, event.ydata
Good catch. I checked in a slightly different version of the fix.
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
*re-reads email*
Apparently it won't teach me.
Sorry for the spam.
2008/11/3 Neil Crighton <neilcrighton@...149...>:
···
Thanks - sorry for posting the mailing list address instead of the the
event handling page(!). That'll teach me to email before
proof-reading...
2008/10/29 Ryan May <rmay31@...149...>:
Neil Crighton wrote:
I noticed on the event handling doc page:
matplotlib-devel@lists.sourceforge.net
that the draggable rectangle example doesn't work in version 0.98.3.
The rectangle class no longer seems to have the xy property. If you
replace the current on_press() method in the example with the code
below it seem to work.
def on_press(self, event):
'on button press we will see if the mouse is over us and store
some data'
if event.inaxes != self.rect.axes: return
contains, attrd = self.rect.contains(event)
if not contains: return
xy = self.rect.get_x(),self.rect.get_y()
print 'event contains', xy
x0, y0 = xy
self.press = x0, y0, event.xdata, event.ydata
Good catch. I checked in a slightly different version of the fix.
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma