Esempio n. 1
0
 def __init__(self, canvas, controller, coord1, coord2):
     self.canvas = canvas
     self.controller = controller
     self._id = canvas.create_line(
         coord1.x,
         coord1.y,
         coord2.x,
         coord2.y,
         fill=self.controller.tool.studio.style.colors["accent"],
         tag=("link", "controller"),
         dash=(5, 4),
         width=2)
     self.link_coord(coord1, coord2)
     canvas.tag_bind(self._id, "<ButtonRelease-1>", self._end_drag)
     MenuUtils.bind_canvas_context(self.canvas, self._id,
                                   self._context_menu)
     canvas.tag_bind(self._id, "<Motion>", self._drag)
     self.active.add(self)
     self._coord_latch = None
Esempio n. 2
0
 def __init__(self, canvas, controller, x, y):
     self.radius = self.min_radius
     self.canvas = canvas
     self.controller = controller
     self.x = x
     self.y = y
     self._id = canvas.create_oval(
         x - self.radius,
         y - self.radius,
         x + self.radius,
         y + self.radius,
         fill=self.controller.tool.studio.style.colors["accent"],
         tags=("coordinate", "controller"))
     canvas.tag_bind(self._id, "<ButtonRelease-1>", self._end_drag)
     canvas.tag_bind(self._id, "<Motion>", self._drag)
     canvas.tag_bind(self._id, "<Enter>", lambda _: self.grow_effect())
     canvas.tag_bind(self._id, "<Leave>", lambda _: self.grow_effect(True))
     MenuUtils.bind_canvas_context(self.canvas, self._id,
                                   self._context_menu)
     self.active.add(self)
     self._listeners = []