事件冒泡在kivy

时间:2015-08-31 14:19:42

标签: python kivy

事件冒泡如何在Kivy工作?为什么在回调中调用super()?例如super(NameClass,self).on_touch_down()

class MyWidget(Widget):
    def on_touch_down(self, touch):
        if <condition>:
            ...
            return True
        return super(MyWidget,self).on_touch_down(touch)

另一个问题,为什么在漫游中通过comicwidgets.py在此代码中调用super()

 def on_touch_down(self, touch):
    if self.collide_point(touch.x, touch.y):
        self.touched = True
        self.select()
        super(DraggableWidget, self).on_touch_down(touch) # Why this call?
        return True
    return super(DraggableWidget, self).on_touch_down(touch)

资源:Code example from Chapter03_code/05-Scatter...

0 个答案:

没有答案