Timer events
EAS
eriksp at attbi.nospam.com
Mon May 17 20:48:05 EDT 2004
While this topic is still up, can someone look at my program and tell me how
to keep the total time in one place? (meaning updating it instead of
printing it each time.)
--------------------------------------------
# Timer, lets the user input a time then alerts with
# system bell when that time is up.
h = 0
m = 0
s = 0
hou = 24
min = 60
sec = 60
print "Enter the hours, minutes, and seconds you want the computer to wait."
while hou < 0 or hou > 23:
hou = input("Hours: ")
while min < 0 or min > 59:
min = input("Minutes: ")
while sec < 0 or sec > 59:
sec = input("Seconds: ")
print
import time
while True:
time.sleep(1)
s += 1
if s == 60:
s = 0
m += 1
if m == 60:
m = 0
h += 1
print h, ":", m, ":", s
if h == hou and m == min and s == sec:
break
print "\a\a\a"
exit = raw_input("\nPress enter to exit.")
More information about the Python-list
mailing list