コード例 #1
0
class ButtonInRotabox(Rotabox):
    def __init__(self, **kwargs):
        super(ButtonInRotabox, self).__init__(**kwargs)
        self.btn = Button(text='A Button in Rotabox', on_press=self.rotate)
        self.add_widget(self.btn)
        # self.draw_bounds = True

    def on_touch_down(self, touch):
        if self.collide_point(*touch.pos):
            self.btn.dispatch('on_press')
            self.btn._do_press()

    def on_touch_up(self, touch):
        if self.collide_point(*touch.pos):
            self.btn._do_release()

    def rotate(self, *args):
        self.angle -= 5