[英]How to ref a TextInput from one screen in another screen in Kivy/Python?
[英]Kivy: How do I move from one canvas/screen to another?
据说我有这个。
class MainGui(App):
def build(self):
root = BoxLayout(orientation="vertical")
login_button = Button(text="Let's go")
login_button.bind(on_press = self.login)
login_button_area.add_widget(login_button)
root.add_widget(login_button_area)
def login(self, instance):
pass
现在,当单击login_button时,我想将整个布局更改为新布局。 我怎么做?
我试过了
def login(self, instance):
root = BoxLayout(orientation='vertical')
textinput = TextInput(text='Hello world', multiline=False)
textinput.bind(on_text_validate=self.on_enter)
root.add_widget(textinput)
return root
使用kivy.uix.screenmanager
。 文档中的第二个示例(带有菜单屏幕和设置屏幕的第二个示例)应该很有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.