python==3.10.12
Kivy ==v2.3.0
kivymd== 2.0.1.dev0
from kivy.lang import Builder
from kivymd.uix.screen import MDScreen
from kivymd.uix.screenmanager import MDScreenManager
from
kivymd.app import MDApp
from kivy.clock import Clock
KV = '''
SM:
MDScreenManager:
id:sm
<MScreen>:
md_bg_color: self.theme_cls.backgroundColor
MDScrollView:
MDBoxLayout:
orientation: "vertical"
spacing: "20dp"
adaptive_height: True
size_hint_x: .8
pos_hint: {"center_x": .5, "center_y": .5}
MDTextField:
mode: "filled"
radius:'25dp'
MDTextFieldLeadingIcon:
icon: "magnify"
theme_icon_color: "Custom"
icon_color_normal: "lightgreen"
MDTextFieldHintText:
text:"Search..."
MDTextFieldTrailingIcon:
icon: "information"
MDTextField:
mode: "filled"
radius:'25dp'
MDTextFieldLeadingIcon:
icon: "magnify"
theme_icon_color: "Custom"
icon_color_normal: "lightgreen"
MDTextFieldHintText:
text:"Search..."
MDTextFieldTrailingIcon:
icon: "information"
'''
class SM(MDScreen):
def __init__(self,*args,**kargs):
super().__init__(*args,**kargs)
def on_kv_post(self,obj):
print("##",self.ids)
#self.ids.sm.add_widget(MScreen())
class MScreen(MDScreen):pass
class Example(MDApp):
def build(self):
self.theme_cls.primary_palette = "Olive"
Builder.load_string(KV)
return SM()
Example().run()