@@ -251,7 +251,8 @@ is created every time a mouse is pressed::
251251
252252 def __call__(self, event):
253253 print('click', event)
254- if event.inaxes!=self.line.axes: return
254+ if event.inaxes != self.line.axes:
255+ return
255256 self.xs.append(event.xdata)
256257 self.ys.append(event.ydata)
257258 self.line.set_data(self.xs, self.ys)
@@ -277,17 +278,19 @@ event.ydata)``. In addition to the ``LocationEvent`` attributes, it also has:
277278Draggable rectangle exercise
278279----------------------------
279280
280- Write draggable rectangle class that is initialized with a
281+ Writea draggable rectangle class that is initialized with a
281282`.Rectangle ` instance but will move its ``xy ``
282- location when dragged. Hint: you will need to store the original
283- ``xy `` location of the rectangle which is stored as rect.xy and
283+ location when dragged.
284+
285+ Hint: You will need to store the original
286+ ``xy `` location of the rectangle which is stored as ``rect.xy `` and
284287connect to the press, motion and release mouse events. When the mouse
285288is pressed, check to see if the click occurs over your rectangle (see
286289`.Rectangle.contains `) and if it does, store
287- the rectangle xy and the location of the mouse click in datacoords .
290+ the rectangle xy and the location of the mouse click in datacoordinates .
288291In the motion event callback, compute the deltax and deltay of the
289292mouse movement, and add those deltas to the origin of the rectangle
290- you stored. The redraw the figure. On the button release event, just
293+ you stored, then redraw the figure. On the button release event, just
291294reset all the button press data you stored as None.
292295
293296Here is the solution::