0
首先,我是新的基维。 myApp基于kivy-example/demo/kivycatlog
,我修改PopupContainer.kv
,但我的代码不起作用。Kivy弹出窗口和按钮文本
PopupContainer.kv
BoxLayout:
id: bl
orientation: "vertical"
popup: popup.__self__
canvas:
Color:
rgba: .18, .18, .18, .91
Rectangle:
size: self.size
pos: self.pos
Button:
id: showPopup1
text: 'press to show popup'
on_release: root.popup.open()
Button:
id: showPopup2
text: 'press to show popup'
on_release: root.popup.open()
Popup:
id: popup
on_parent: if self.parent == bl: bl.remove_widget(self)
title: "An example popup"
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'vertical'
Button:
id: accept
text: "yes"
on_release: status.text = self.text
Button:
id: cancel
text: "no"
on_release: status.text = self.text
Label:
id: status
text: "yes or no?"
Button:
text: "press to dismiss"
on_release: popup.dismiss()
我想改变text(showPopup)
当我点击 “是” 或 “否” 在showPopup
的文本。
恩....我还是试试吧 如何在代码中制作关系变量? –
我不明白你的问题在哪里 – Juggernaut