kivy: make widget react different for single- and double-tap

我们两清 提交于 2021-02-07 04:19:43

问题


I detect a double-tap on a widget like described in the kivy doc. How can i realize different reaction for single- and double-tap in a good way?

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:


I would check this out: https://groups.google.com/forum/#!topic/kivy-users/slYzx9uZ39M it looks like you can set a tap wait period where it waits to see if you are going to tap again after the first tap. Hope this helps. Wish I knew more :P



来源:https://stackoverflow.com/questions/25429156/kivy-make-widget-react-different-for-single-and-double-tap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!