mirror of https://github.com/kivy/kivy.git
move kivy.require before other imports and convert tabs to space-tabs in kv example
This commit is contained in:
parent
aeeac3e48c
commit
3d3a6d0872
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue