2011-04-22 10:15:47 +00:00
|
|
|
import kivy
|
|
|
|
kivy.require('1.0.5')
|
|
|
|
|
|
|
|
from kivy.uix.floatlayout import FloatLayout
|
|
|
|
from kivy.app import App
|
|
|
|
from kivy.properties import ObjectProperty, StringProperty
|
|
|
|
|
|
|
|
|
|
|
|
class Controller(FloatLayout):
|
2012-01-26 07:26:30 +00:00
|
|
|
'''Create a controller that receives a custom widget from the kv lang file.
|
|
|
|
|
|
|
|
Add an action to be called from the kv lang file.
|
2011-04-22 10:15:47 +00:00
|
|
|
'''
|
2012-05-20 21:20:26 +00:00
|
|
|
label_wid = ObjectProperty()
|
|
|
|
info = StringProperty()
|
2011-04-22 10:15:47 +00:00
|
|
|
|
|
|
|
def do_action(self):
|
|
|
|
self.label_wid.text = 'My label after button press'
|
|
|
|
self.info = 'New info text'
|
|
|
|
|
|
|
|
|
|
|
|
class ControllerApp(App):
|
|
|
|
|
|
|
|
def build(self):
|
|
|
|
return Controller(info='Hello world')
|
|
|
|
|
2016-12-17 09:41:12 +00:00
|
|
|
|
2012-07-29 19:43:01 +00:00
|
|
|
if __name__ == '__main__':
|
2011-04-22 10:15:47 +00:00
|
|
|
ControllerApp().run()
|