def __init__(self):
        Clutter.Texture.__init__(self)

        self._path = Clutter.Path()

        self.connect("motion-event", self.pointer_motion_cb)
        self.connect("enter-event", self.pointer_enter_cb)
        self.set_reactive(True)
コード例 #2
0
    def __init__(self):
        Clutter.Actor.__init__(self)

        self._path = Clutter.Path()

        self.set_reactive(True)

        # set default color to black
        color = Clutter.Color.from_string("#000")
        self.set_color(color)
コード例 #3
0

def pointer_enter_cb(self, event, path):
    stage_x, stage_y = event.get_coords()
    x, y = self.transform_stage_point(stage_x, stage_y)

    print("enter; x %s, y %s" % (x, y))

    path.add_move_to(x, y)

    self.queue_redraw()

    return True


path = Clutter.Path()

stage = Clutter.Stage()
stage.set_color(Clutter.Color.from_string("#333355"))
stage.set_size(400, 400)
stage.connect("destroy", Clutter.main_quit)

rect = Clutter.Rectangle()
rect.set_color(Clutter.Color.from_string("#aa9900"))
rect.set_size(300, 300)
rect.add_constraint(
    Clutter.AlignConstraint.new(stage, Clutter.AlignAxis.X_AXIS, 0.5))
rect.add_constraint(
    Clutter.AlignConstraint.new(stage, Clutter.AlignAxis.Y_AXIS, 0.5))

stage.add_actor(rect)