def PointerMotionEvent(self, event): if self.button_down: if self.canvas is not None: press = self.pressevent if hypot(press.x - event.x, press.y - event.y) > 3: guide = GuideLine(Point(0, 0), self.orient == HORIZONTAL) self.canvas.PlaceObject(guide) press.x = press.x_root - self.canvas.winfo_rootx() press.y = press.y_root - self.canvas.winfo_rooty() self.canvas.ButtonPressEvent(press) self.canvas.grab_set() self.button_down = 0
def guide(self, pos, horizontal): if horizontal: p = Point(0, pos) else: p = Point(pos, 0) self.append_object(GuideLine(p, horizontal))
def AddGuideLine(self, horizontal=1): self.canvas.PlaceObject(GuideLine(Point(0, 0), horizontal))