如何启用以前禁用的kivy中的按钮? [英] How can I enable the button in kivy which is disabled before?
问题描述
:
帆布:
颜色:
rgb:1、1、1
长方形:
来源:"bbbg.png"
大小:self.size
BoxLayout:
方向:垂直"
:
canvas:
Color:
rgb: 1, 1, 1
Rectangle:
source: "bbbg.png"
size: self.size
BoxLayout:
orientation: 'vertical'
Button:
#pos_hint: {'center': .01}
#size_hint_x: 1
#size_hint_y: 0.07
#size_hint_x: 0.07
disabled:True
pos_hint: {'center': 0}
background_color: 1,1,1,0
on_release: root.manager.current = 'select_next'
on_press: app.nextbtn(self)
source: None
name:""
Image:
size: 540, 540
center: self.parent.center
allow_stretch: True
source: "playbutton.png"
推荐答案
获取对按钮的引用,然后只需将Disabled属性设置为False.例如,如果它是您的根窗口小部件,则可以执行App.get_running_app().root.disabled = False
.
Get a reference to the button, and then simply set the disabled property to False. For instance, if it is your root widget, you could do App.get_running_app().root.disabled = False
.
获取参考的最佳方法完全取决于上下文,如果不清楚,请提供更多信息.
The best way to get a reference depends entirely on the context, provide more information if it's not clear.
这篇关于如何启用以前禁用的kivy中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!