Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # kivy_pro_template.py
- from kivy.config import Config
- Config.set('kivy', 'log_level', 'debug')
- from kivy.app import App
- from kivy.lang import Builder
- from kivy.factory import Factory
- from kivy.uix.boxlayout import BoxLayout
- kv = """
- <NewB@Button>:
- text: 'New button'
- <Test>:
- orientation: 'vertical'
- Button:
- text: 'Add a new button'
- on_press: root.callback()
- """
- Builder.load_string(kv)
- class Test(BoxLayout):
- def __init__(self, *args, **kwargs):
- super(Test, self).__init__(*args, **kwargs)
- self.callback()
- def callback(self):
- self.add_widget(Factory.NewB())
- class TestApp(App):
- def build(self):
- return Test()
- if __name__ == '__main__':
- TestApp().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement