from kivy.lang import Builder
from
kivymd.app import MDApp
from kivymd.uix.button.button import MDIconButton
colors = {
"Teal": {
"200": "#212121",
"500": "#212121",
"700": "#212121",
},
"Red": {
"200": "#C25554",
"500": "#C25554",
"700": "#C25554",
},
"Light": {
"StatusBar": "E0E0E0",
"AppBar": "#202020",
"Background": "#2E3032",
"CardsDialogs": "#FFFFFF",
"FlatButtonDown": "#CCCCCC",
},
}
string = """
BoxLayout:
id: container
orientation: "vertical"
spacing: "10dp"
padding: "10dp"
ScrollView:
id: scroll
MDList:
id: lst
MDLabel:
text: "Material Design Icon Example"
halign: "center"
# color: "blue"
MDIconButton:
id: icon
icon: "language-python"
icon_size: "24dp"
theme_icon_color: "Custom"
# icon_color: "blue"
elevation: 8
pos_hint: {"center_x": .5, "center_y": .5}
MDIcon:
icon: "menu"
# icon_color: "blue"
pos_hint: {"center_x": .5, "center_y": .5}
theme_text_color: "Primary"
size_hint: None, None
size: "48dp", "48dp"
"""
class MyKivyApp(MDApp):
def build(self):
self.theme_cls.colors = colors
self.theme_cls.primary_palette = "Red"
self.theme_cls.theme_style = "Light"
KV = Builder.load_string(string)
return KV
def on_start(self, *args):
lst = self.root.ids.lst
for _ in range(0, 20):
icon_btn = MDIconButton(icon="language-python")
lst.add_widget(icon_btn)
if __name__ == "__main__":
MyKivyApp().run()