Kivy 如何隐藏控件?

设置opacity 属性为0即可, 如下面的例子,当Button 1按下时整个Boxlayout都隐藏起来

#:kivy 1.4

BoxLayout:
    orientation: 'vertical'
    padding: 20
    spacing: 10
    opacity:1
    Button:
        text: "Button 1"
        on_release: self.parent.opacity=0
        size_hint: 1, None
    Button:
        text: "Button 2"
        size_hint: 1, 0.5
    Button:
        text: "Button 3"
posted @ 2020-07-07 09:53  Onsunsl  阅读(437)  评论(0编辑  收藏  举报