我似乎无法让我的弹出窗口打开,因为它不是'定义'。所有东西都从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