In this video I’ll show you how to teach yourself KivyMD quickly and easily!
In the last video we looked at the Kitchen Sink app which shows you all of the different elements that you can use in KivyMD. In this video I’ll show you how to dive into the code and actually learn how to use each of those elements.
KivyMD comes with some fantastic documentation that shows you exactly how to use any of the elements you see in the Kitchen Sink App.
We’ll take a look at that documentation and use it to create a card and a slider in this video. You’ll see just how easy it is!
Python Code: testing.py
GitHub Code: testing.py
from kivy.app import App from kivy.uix.widget import Widget from kivy.properties import ObjectProperty from kivy.lang import Builder from kivymd.app import MDApp # Designate Our .kv design file Builder.load_file('testing.kv') class MyLayout(Widget): pass class AwesomeApp(MDApp): def build(self): return MyLayout() if __name__ == '__main__': AwesomeApp().run()
Kivy Design Code: testing.kv
GitHub Code: testing.kv
<MyLayout> BoxLayout: orientation: "vertical" size: root.width, root.height Screen: MDCard: orientation: "vertical" padding: "8dp" size_hint: None, None size: "280dp", "180dp" pos_hint: {"center_x": .5, "center_y": .5} MDLabel: text: "Title" theme_text_color: "Secondary" size_hint_y: None height: self.texture_size[1] MDSeparator: height: "1dp" MDLabel: text: "Body" Screen MDSlider: min: 0 max: 100 value: 40
Add comment