Python Kivy: Update Label
i am new in the Kivy Topic and i have got a simple question (i think). With the function 'zufall' i create a random number. This number should update every 2 seconds in the label.
Solution 1:
Firstly you have to return
your random number from your zufall
function, and call that function from your __init__
like this:
# runs on initialization
def zufall(self, *args):
random_number = random.randrange(10)
random_number = str(random_number)
return random_number
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.cols = 2 # used for our grid
self.add_widget(Label(text='OEE'))
self.add_widget(Label(text=self.zufall()))
Post a Comment for "Python Kivy: Update Label"