我似乎無法讓我的彈出窗口打開,因爲它不是'定義'。所有東西都從Python傳遞到Kivy語言(因爲它讓我更容易跟蹤所有內容),這就是問題所在。Kivy Popup錯誤
<StoryScreen>:
name: "story"
BoxLayout:
id: storyScreen
Popup:
id: "popup"
title: "Settings"
on_parent:
if self.parent == storyScreen: self.parent.remove_widget(self)
GridLayout:
cols: 2
Accordion:
orientation: "vertical"
AccordionItem:
title: "Main Character"
size_hint:.9, 0.10
pos_hint: {'x':0.05, 'y':0.85}
Label:
id: first
text: "First Name"
AccordionItem:
title: "Love Interest"
size_hint: .9, 0.10
pos_hint: {'x':0.05, 'y':0.70}
Button:
text: "What's up"
Button:
text: "Press to open popup"
on_release: popup.open()
Label:
text: "This is a label"
我的追蹤誤差寫着:
File "/Applications/Kivy.app/Contents/Resources/kivy/kivy/lang.py", line 1299, in custom_callback
exec(__kvlang__.co_value, idmap)
File "./story.kv", line 54, in <module>
on_release: popup.open()
NameError: name 'popup' is not defined
甚至當我嘗試添加到Python
class popup(Popup):
pass
它仍然拋出一個定義錯誤。幫幫我?
這真的很簡單。謝謝! :d – 2015-01-27 16:40:37