0
我正在嘗試使用remove_widget函數讓我的按鈕在點擊後消失。根據documentation我相信這是實現這一目標的正確方法。但是,當我試圖刪除按鈕,我得到一個崩潰。不知道這是否與引用類型的小部件或別的東西有關。Kivy [widget]沒有任何屬性[child_widget]
這裏是我的main.kv
<MainPanel>:
orientation: 'vertical'
spacing: 1
AppActionBar:
size_hint: (1., 0.1)
ScrollView:
id: scrollview_main
do_scroll_x: False
do_scroll_y: False if root.fullscreen else (content.height > root.height - dp(16))
AnchorLayout:
id: anchorlayout_main
size_hint_y: None
height: root.height if root.fullscreen else max(root.height, content.height)
GridLayout:
id: content
cols: 1
spacing: '8dp'
padding: '8dp'
size_hint: (1, 1) if root.fullscreen else (.8, None)
height: self.height if root.fullscreen else self.minimum_height
Button:
id: button_open_process
size_hint_y: None
text: 'Open New Process'
height: '48dp'
width: '120dp'
on_release:
root.open_process()
root.remove_widget(root.button_attach_process) <-- offending line
#root.remove_widget(root.button_open_process)
Button:
id: button_attach_process
size_hint_y: None
text: 'Attach to Currently Running Process'
height: '48dp'
width: '120dp'
on_release: root.attach_process()
並與ID button_open_process
AttributeError: 'MainPanel' object has no attribute 'button_attach_process'
是什麼原因造成這個問題點擊按鈕時,我得到的錯誤?