本文介紹了如何禁用 Kivy 中的小部件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我閱讀了 Kivy 教程,但找不到如何禁用小部件(例如,按鈕).
I read the Kivy tutorial and couldn't find how to disable a widget (for example, a Button).
def foo(self, instance, *args):
#... main business logic, and then
instance.disable = False
# type(instance) = kivy.uix.Button
我將 foo
與 functools.partial
綁定.
什么是正確的參數?
推薦答案
如果你使用的是 kivy 版本 >= 1.8 那么你可以做 widget.disabled = True.如果在以前的版本中您可以簡單地自行管理禁用,只需確保它不會對觸摸做出反應并在禁用時顯示另一種外觀.
If you are using kivy version >= 1.8 then you can just do widget.disabled = True. If on previous versions you can simply manage the disabling yourself, just make sure it doesn't react to touch and displays a alternative look when disabled.
這篇關于如何禁用 Kivy 中的小部件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!