def _on_mouse_move(self, event):
    " move crop along with the user's mouse "
    if self.movingCrop:
        if _point_on_image((event.x, event.y), self.resized_img):
            deltaX = (event.x - self.lastLocation[0])
            deltaY = (event.y - self.lastLocation[1])
            if ((self.box[0] + deltaX) < 0):
                deltaX = 0
            if ((self.box[1] + deltaY) < 0):
                deltaY = 0
            if ((self.box[2] + deltaX) > self.resized_img.size[0]):
                deltaX = (self.box[2] - self.resized_img.size[0])
            if ((self.box[3] + deltaY) > self.resized_img.size[1]):
                deltaY = (self.box[3] - self.resized_img.size[1])
            self.box = [(self.box[0] + deltaX), (self.box[1] + deltaY), (self.box[2] + deltaX), (self.box[3] + deltaY)]
            self._refresh_crop_rectangle(deltaX, deltaY)
            self.lastLocation = [event.x, event.y]
move crop along with the user's mouse
def _on_mouse_move(self, event):
    "  "
    if self.movingCrop:
        if _point_on_image((event.x, event.y), self.resized_img):
            deltaX = (event.x - self.lastLocation[0])
            deltaY = (event.y - self.lastLocation[1])
            if ((self.box[0] + deltaX) < 0):
                deltaX = 0
            if ((self.box[1] + deltaY) < 0):
                deltaY = 0
            if ((self.box[2] + deltaX) > self.resized_img.size[0]):
                deltaX = (self.box[2] - self.resized_img.size[0])
            if ((self.box[3] + deltaY) > self.resized_img.size[1]):
                deltaY = (self.box[3] - self.resized_img.size[1])
            self.box = [(self.box[0] + deltaX), (self.box[1] + deltaY), (self.box[2] + deltaX), (self.box[3] + deltaY)]
            self._refresh_crop_rectangle(deltaX, deltaY)
            self.lastLocation = [event.x, event.y]