def on_motion(self, event):
        'on motion we will move the rect if the mouse is over us'
        if self.press is None:
            return

        if event.inaxes != self.ax:
            return
        # print(event.inaxes)

        x0, y0, btn = self.press
        x0.append(event.xdata)
        y0.append(event.ydata)
def on_motion ( self , event ) : if self . press is None : return if event . inaxes != self . ax : return x0 , y0 , btn = self . press x0 . append ( event . xdata ) y0 . append ( event . ydata )
on motion we will move the rect if the mouse is over us