
from kivy.properties import *from date time import datemy_int = NumericProperty(42)my_string = StringProperty('My string')my_dict = DictProperty({'key': 'value'})my_obj = ObjectProperty(date())my_ref = referenceListProperty( my_int, my_string, my_dict, my_obj )
root = MyRootWidget()box = BoxLayout()box.add_widget(Button())box.add_widget(Button())root.add_widget(box)
MyRootWidget:BoxLayout:Button:Button:
MyWidget:cols: len(some_data_from_python_file)on_size: my_callback_methodpos: self.center_x / 2, self.center_y * 2
<MyWidget>:label_widget: label_widgetButton:text: 'Add Button'on_press: root.add_widget(label_widget)
<Marvel>Label:id: lokitext: 'Loki: I AM YOUR GOD!'Button:id: hulktext: 'Press to smash Loki'on_release: root.hulk_smash()
class Marvel(BoxLayout):def hulk_smash(self):self.ids.hulk.text = "Hulk: Puny God!"self.ids.loki.text = "Loki: >_<!!!"