Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## This is the controller.kv file
- #:kivy 1.0
- <MyContainer>:
- Button:
- text: 'My controller info is: '
- <Controller>:
- ## And this is the main.py file
- import kivy
- kivy.require('1.0.5')
- from kivy.uix.floatlayout import FloatLayout
- from kivy.uix.boxlayout import BoxLayout
- from kivy.app import App
- class MyContainer(BoxLayout):
- def do_action(self):
- print "hi!"
- class Controller(MyContainer):
- def __init__(self, **kwargs):
- self.do_action()
- super(Controller, self).__init__(**kwargs)
- class ControllerApp(App):
- def build(self):
- return Controller()
- if __name__ == '__main__':
- ControllerApp().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement