lundi 26 janvier 2015

I cannot get the restart button to work on my stopwatch. Using Pythonista on iPhone


import ui
from time import *
start = int(time())
def stop_time(sender):
finish = int(time())
total_time = int(finish - start)
button1 = str("Your time is %i seconds." % (total_time))
sender.title = None
sender.title = str(button1)


How do I allow the restart button to change the start variable?



def restart_time(sender):
start = int(time())
button2 = str("Stopwatch restarted.")
sender.title = None
sender.title = str(button2)
ui.load_view('stop_time').present('sheet')



Aucun commentaire:

Enregistrer un commentaire