Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.app import App
- from kivy.uix.boxlayout import BoxLayout
- from kivy.properties import StringProperty
- from kivy.clock import Clock
- class FirstLayout(BoxLayout):
- r = 0
- def __init__(self, **kwargs):
- super(FirstLayout, self).__init__(**kwargs)
- self.change = self.ids.temp_label
- def my_callback(self, *args):
- self.r += 1
- print self.r
- t = str(self.r)
- self.change.text = t
- class TryApp(App):
- def build(self):
- Clock.schedule_interval(FirstLayout().my_callback, 1)
- return FirstLayout()
- app = TryApp()
- app.run()
- <FirstLayout>:
- orientation: 'vertical'
- Label:
- id: temp_label
- text: 'something'
- Button:
- on_press: root.my_callback()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement