Supposedly, I have this.
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
Now when login_button is clicked I want to change the whole layout to a new one. How do I do that?
I tried this
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
Use kivy.uix.screenmanager
. Second example from documentation (one with Menu Screen and a Settings Screen) should be useful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.