update widget kivy code example
Example: update widget kivy
from kivy.clock import Clock
class app(App):
def build(self):
self.layout = Layout()
self.name = Label(text = "john")
self.layout.add_widget(self.name)
self.current_i = 0
Clock.schedule_interval(self.update, 1)
return self.layout
def update(self, *args):
self.name.text = str(self.current_i)
self.current_i += 1
if self.current_i >= 50:
Clock.unschedule(self.update)