我需要使用kivyMD构建应用程序。我已经尝试了很多资源,但是一次又一次遇到相同的问题。下面的代码运行,但是输出变得模糊且重复,如输出图像中所示。
First screen On clicking the button
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivymd.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty, StringProperty
from kivymd.uix.label import MDLabel
class LayoutClass(BoxLayout):
s_manager = ObjectProperty(None)
tf_word = StringProperty('')
def change_screen(self, screen, *args):
self.s_manager.current = screen
KV = """
LayoutClass:
s_manager:s_manager
orientation: 'vertical'
ScreenManager:
id: s_manager
word_screen: word_screen
meaning_screen: meaning_screen
Screen:
id: word_screen
name: 'word_screen'
tf_word:tf_word
MDTextField:
id: tf_word
name: 'tf_word'
hint_text: 'Enter the Word'
halign: "center"
MDRectangleFlatButton:
text: 'Search'
on_press: root.change_screen('meaning_screen')
Screen:
id: meaning_screen
name: 'meaning_screen'
MDLabel:
text: "Meaning"
"""
class TestApp(MDApp):
def __init__(self, **kwargs):
self.title = "wordie-DEV"
super().__init__(**kwargs)
def build(self):
self.root = Builder.load_string(KV)
if __name__ == '__main__':
TestApp().run()