first commit
This commit is contained in:
commit
417e54da96
5696 changed files with 900003 additions and 0 deletions
Binary file not shown.
|
@ -0,0 +1,16 @@
|
|||
#:kivy 1.0
|
||||
|
||||
<Controller>:
|
||||
label_wid: my_custom_label
|
||||
|
||||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
padding: 20
|
||||
|
||||
Button:
|
||||
text: 'My controller info is: ' + root.info
|
||||
on_press: root.do_action()
|
||||
|
||||
Label:
|
||||
id: my_custom_label
|
||||
text: 'My label before button press'
|
29
kivy_venv/share/kivy-examples/guide/designwithkv/main.py
Normal file
29
kivy_venv/share/kivy-examples/guide/designwithkv/main.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
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):
|
||||
'''Create a controller that receives a custom widget from the kv lang file.
|
||||
|
||||
Add an action to be called from the kv lang file.
|
||||
'''
|
||||
label_wid = ObjectProperty()
|
||||
info = StringProperty()
|
||||
|
||||
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')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ControllerApp().run()
|
Loading…
Add table
Add a link
Reference in a new issue