Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. from kivy.app import App
  2. from kivy.uix.boxlayout import BoxLayout
  3. from kivy.properties import StringProperty
  4. from kivy.clock import Clock
  5.  
  6.  
  7. class FirstLayout(BoxLayout):
  8. r = 0
  9.  
  10. def __init__(self, **kwargs):
  11. super(FirstLayout, self).__init__(**kwargs)
  12. self.change = self.ids.temp_label
  13.  
  14. def my_callback(self, *args):
  15. self.r += 1
  16. print self.r
  17. t = str(self.r)
  18. self.change.text = t
  19.  
  20.  
  21. class TryApp(App):
  22. def build(self):
  23. Clock.schedule_interval(FirstLayout().my_callback, 1)
  24. return FirstLayout()
  25.  
  26.  
  27. app = TryApp()
  28. app.run()
  29.  
  30. <FirstLayout>:
  31. orientation: 'vertical'
  32. Label:
  33. id: temp_label
  34. text: 'something'
  35. Button:
  36. on_press: root.my_callback()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement