Total beginner here. I am trying to sort of animate a change to a text label, similar to how the colormixer.py example updates the hex color value. I have a loop that calls for the multiple label text changes but only the terminal value is displayed. I have tried various examples here using ui.update or ui.animate to no avail. What is the best way to do this? Thanks.
Assume a pyui with a button and a label. This is what I do not have working.
# coding: utf-8
import ui
import random
import time
def dieRoll():
return random.randint(1, 6)
def button_tapped(sender):
v=sender.superview
def updateLabel():
v['lblRoll'].text=str(dieRoll())
print v['lblRoll'].text
for n in range(6) :
updateLabel()
v.set_needs_display
time.sleep(1.0)
#also tried
#ui.delay(updateLabel,1.0)
v = ui.load_view()
v.present('sheet')