First import nessary things like
from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.screen import MDScreen
now either enter kivy code in """ or import method
kvCode= """
MDScreen:
MDLabel:
text: "Hello World"
pos: 50, 56
md_bg_color: #bbb
"""
from kivymd.uix.label import MDLabel
kvCode= MDScreen(
MDLabel(
text="Hello World",
pos=(50, 56),
md_bg_color="#bbb"
)
)
now create class by parameter MDApp or App
class MyApp(MDApp):
def build(self):
self.theme_cls.primary_palette= "red";
self.theme_cls.theme_style= "light";
return Builder.load_string(kvCode);
then run the execute the class by
MyApp().run()