def __init__(self, tbox, x, y): super(Ellipse, self).__init__(tbox) self.origin = x, y self.cuadranteNegX = False self.cuadranteNegY = False self.marker1 = Marker(self.tbox.layer, x, y, color="Red", callback=self.moveto) self.ellipse = GooCanvas.CanvasEllipse( parent=tbox.layer, x=x, y=y, width=0, height=0, fill_color_rgba=self.fill_color, stroke_color_rgba=self.stroke_color, line_width=self.line_width) self.id_release = tbox.layer.connect("button-release-event", self.button_released) self.id_motion = tbox.layer.connect("motion-notify-event", self.button_moved)
def __init__(self, layer, x, y, radius=8, color="White", callback=None): self.x, self.y = x, y self.radius = radius self.color = color self.position = None self.callback = callback self.marker = GooCanvas.CanvasEllipse(parent=layer, center_x=x, center_y=y, radius_x=radius, radius_y=radius, stroke_color=color, fill_color_rgba=0xffffff20, line_width=2) self.marker.connect("button-press-event", self.button_pressed) layer.connect("button-release-event", self.button_released) layer.connect("motion-notify-event", self.button_moved)