I noticed on the event handling doc page: mat...@li... 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: > > mat...@li... > > 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: >> >> mat...@li... >> >> 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
On Wed, Oct 29, 2008 at 4:00 PM, Ryan May <rm...@gm...> 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
Agreed. I think it is missing only be accident. Mike John Hunter wrote: > On Wed, Oct 29, 2008 at 4:00 PM, Ryan May <rm...@gm...> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
John Hunter wrote: > On Wed, Oct 29, 2008 at 4:00 PM, Ryan May <rm...@gm...> 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. Done in r6366. Also reverted the changes to the exercise, as the description still mentioned using the xy attribute. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma
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 <rm...@gm...>: > Neil Crighton wrote: >> I noticed on the event handling doc page: >> >> mat...@li... >> >> 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 <nei...@gm...>: > 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 <rm...@gm...>: >> Neil Crighton wrote: >>> I noticed on the event handling doc page: >>> >>> mat...@li... >>> >>> 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 >> >