I tried debug this code, and it worked correctly, but after I running this one, the whole app crushed.
def start(sender):
def ani_pause():
sender.image = ui.Image.named('iob:pause_32')
def ani_play():
sender.image = ui.Image.named('iob:play_32')
global is_playing
if is_playing is False:
ui.animate(ani_pause)
is_playing = True
start_time = time.time()
label = sender.superview['label1']
label2 = sender.superview['label2']
time_left = 0
while int(label.text) != 131:
time.sleep(0.01)
time_now = time.time()
duration = time_now - start_time
time_left += 1
label2.text = str(10 - time_left)
if label2.text is '0':
label.text = str(int(label.text) + 1)
time_left = 361
ui.animate(ani_play)
is_playing = False
else:
is_playing = False
ui.animate(ani_play)