本文介紹了kivy:使小部件對單擊和雙擊的反應不同的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我檢測到一個小部件上的雙擊,如 kivy 文檔中所述.如何以一種好的方式實現單擊和雙擊的不同反應?
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)
推薦答案
我會看看這個:https://groups.google.com/forum/#!topic/kivy-users/slYzx9uZ39M看起來您可以設置一個點擊等待期,等待在第一次點擊后查看您是否要再次點擊.希望這可以幫助.希望我知道更多:P
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
這篇關于kivy:使小部件對單擊和雙擊的反應不同的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!