How can I enable the button in kivy which is disabled before?

試著忘記壹切 提交于 2020-01-25 16:37:08

问题


:
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"  

回答1:


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.



来源:https://stackoverflow.com/questions/26409449/how-can-i-enable-the-button-in-kivy-which-is-disabled-before

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