Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f453d1

Browse files
committed
Revert the DraggableRectangle exercise solution to use the Rectangle.xy attribute now that it exists. This agrees with the exercise description.
svn path=/trunk/matplotlib/; revision=6367
1 parent 4507d65 commit 5f453d1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

doc/users/event_handling.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ Here is the solution::
182182

183183
contains, attrd = self.rect.contains(event)
184184
if not contains: return
185-
x0, y0 = self.rect.get_x(), self.rect.get_y()
186-
print 'event contains', x0, y0
185+
print 'event contains', self.rect.xy
186+
x0, y0 = self.rect.xy
187187
self.press = x0, y0, event.xdata, event.ydata
188188

189189
def on_motion(self, event):
@@ -257,8 +257,8 @@ Extra credit solution::
257257
if DraggableRectangle.lock is not None: return
258258
contains, attrd = self.rect.contains(event)
259259
if not contains: return
260-
x0, y0 = self.rect.get_x(), self.rect.get_y()
261-
print 'event contains', x0, y0
260+
print 'event contains', self.rect.xy
261+
x0, y0 = self.rect.xy
262262
self.press = x0, y0, event.xdata, event.ydata
263263
DraggableRectangle.lock = self
264264

0 commit comments

Comments
 (0)