我知道 kivy 和 kivymd 但我还不知道它们的功能。我想在单击按钮时更改我的应用程序的屏幕,我该怎么做?谢谢你。
下面是我的代码
from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
Screen:
MDLabel:
text: "Material Design"
font_style: "H3"
theme_text_color: "Secondary"
pos_hint: {"center_y": 0.9}
halign: "center"
MDRaisedButton:
text: "Start"
md_bg_color: 0, 0.26, 0.27, 1
pos_hint: {"center_x": 0.5, "center_y": 0.2}
on_press: root.manager.current = "main"
MDRectangleFlatButton:
text: "Exit"
md_bg_color: rgba(197, 232, 204, 1)
text_color: 0, 0.26, 0.27, 1
pos_hint: {"center_x": 0.5, "center_y": 0.1}
Screen:
name: "main"
MDLabel:
text: "School guru"
font_style: "H3"
pos_hint: {"center_y": 0.8}
halign: "center"
'''
class MaterialDesign(MDApp):
def build(self):
return Builder.load_string(KV)
MaterialDesign().run()
请尝试编辑我的代码并展示如何操作。
再次感谢您。