Skip to content

Commit

Permalink
move kivy.require before other imports and convert tabs to space-tabs…
Browse files Browse the repository at this point in the history
… in kv example
  • Loading branch information
dessant committed May 15, 2015
1 parent aeeac3e commit 3d3a6d0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
9 changes: 5 additions & 4 deletions examples/kv/ids/id_in_kv/id_in_kv.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
'''
The use of id in .kv
==================================
The use of id in KV
===================
This small example shows how to refer from one widget
on an other widget within .kv
to another within KV.
'''
from kivy.app import App

import kivy
kivy.require('1.8.0')

from kivy.app import App


class TestApp(App):
pass
Expand Down
16 changes: 8 additions & 8 deletions examples/kv/ids/id_in_kv/test.kv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#:kivy 1.8.0

BoxLayout:
orientation: 'vertical'
TextInput:
# setting the id of the widget
id: my_id
text: 'The text of the label is set within kivy'
Label:
# showing the text of the textinput by referring on the id
text: my_id.text
orientation: 'vertical'
TextInput:
# setting the id of the widget
id: my_id
text: 'The text of the label is set within kivy'
Label:
# showing the text of the textinput by referring on the id
text: my_id.text
11 changes: 6 additions & 5 deletions examples/kv/ids/kv_and_py/kv_and_py.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
'''
Referring on ids from .py
==================================
Referring on ids from Python
=============================
This example shows how to refer to an id from a .py file.
This example shows how to refer to an id from a Python file.
'''
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout

import kivy
kivy.require('1.8.0')

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout


class RootWidget(BoxLayout):

Expand Down
19 changes: 9 additions & 10 deletions examples/kv/ids/kv_and_py/test.kv
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#:kivy 1.0
#:kivy 1.8.0

RootWidget:
BoxLayout:
orientation: 'vertical'
Switch:
id: my_switch
on_active: root.first_function(self.active)

Label:
id: my_label
text: 'This text will be changed by the python file'
BoxLayout:
orientation: 'vertical'
Switch:
id: my_switch
on_active: root.first_function(self.active)
Label:
id: my_label
text: 'This text will be changed by the python file'

0 comments on commit 3d3a6d0

Please sign in to comment.