我正在尝试在两个屏幕之间切换.. 但它不起作用.. 它没有显示任何内容或任何错误我不知道是什么问题,这是我的代码
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
class mainWindow(Screen):
pass
class secondWindow(Screen):
pass
class windowManager(ScreenManager):
pass
sm = ScreenManager()
sm.add_widget(mainWindow(name='main'))
sm.add_widget(secondWindow(name='second'))
class multApp(App):
def build(self):
return mainWindow()
if __name__ == "__main__":
multApp().run()
和 mult.kv
windowManager:
mainWindow:
secondWindow:
<mainWindow>:
name: "main"
Button:
text: "Submit"
on_press : root.manager.current = "second"
<secondWindow>:
name: "second"
Button:
text: "go back"
on_press : root.manager.current = "main"