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