Dear all,
I find that, in the following source code,
the property "value" of lbl is automatically binded to the function "on_value"
although I don't define "value" as a NumericProperty instance.
My question is, in general,
is the property defined in a kv file automatically binded to
the callback function "on_xxx"?
My kivy is v1.9.1.
/*--- main.py ---*/
import kivy
from
kivy.app import App
from kivy.uix.boxlayout import BoxLayout
class MyRoot( BoxLayout ):
pass
class myApp( App ):
def build( self ):
return MyRoot()
if __name__ == '__main__':
myApp().run()
/*--- my.kv ---*/
<MyRoot>:
orientation: 'horizontal'
Label:
id: lbl
text: '0'
value: 0
on_value:
self.text = str(self.value)
BoxLayout:
orientation: 'vertical'
Button:
text: 'Increase'
on_press:
lbl.value = lbl.value + 1
Button:
text: 'Reset'
on_press:
lbl.value = 0
WBR,
Kazuya HARAGUCHI
e-mail:
kzy...@gmail.com