kivy:make widget对单击和双击的反应不同

时间:2014-08-21 14:35:42

标签: python kivy

我在小部件上检测到双击,如kivy doc中所述。 如何以良好的方式实现单击和双击的不同反应?

def on_touch_down(self, touch):
    if self.collide_point(*touch.pos):
        if touch.is_double_tap:
            print('here start function B (but not function A in advance!)')
        else:
            print('here start function A')
    return super(MyLabel, self).on_touch_down(touch)

1 个答案:

答案 0 :(得分:0)

我会查看一下:https://groups.google.com/forum/#!topic/kivy-users/slYzx9uZ39M 看起来您可以设置一个等待时间段,等待第一次点击后您是否要再次点按。希望这可以帮助。希望我知道更多:P