from kivymd.app import MDApp
from kivymd.uix.screen import Screen
from kivy.lang import Builder
username_helper = """
MDTextField:
hint_text: "Enter useraname"
helper_text: "or click or forgot username"
helper_text_mode:"on_focus"
icon_right: "android"
icon_right_color:ap.theme_cls.primary_color
pos_hint:{'center_x': 0.5, 'center_y': 0.5}
size_hint_x:None
width:300
"""
class DemoApp(MDApp):
def build(self):
screen = Screen()
self.theme_cls.primary_palette = "Green"
#username = MDTextField(text='Enter Username',
# pos_hint={'center_x': 0.5, 'center_y': 0.5},
# size_hint_x=None, width=300)
username=Builder.load_string(username_helper)
screen.add_widget(username)
return screen
DemoApp().run()
问问题
26 次