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"
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章