Well, I’ve not be too idle on this. In real world time I’ve been poking at these scripts for a while, but just now been getting around to posting them.
So this is version 02 of the timer script. I have been messing with making the timer a function so that I can call it separately. Hopefully this will allow me to eventually make it easier to add a GUI and make it loop until all of the tests are done.
-edit- a few minor changes that made sense after I read the code again.
# a simple countdown timer in python # learning by doing - eh # time.sleep and import time - http://stackoverflow.com/questions/3309664/python-timer-countdown #while loop info from - http://thenewboston.org/watch.php?cat=36&number=25 # conditional and function info from http://openbookproject.net/thinkcs/python/english2e import time #adds the time lib from python def testTimer(): #function that is the timer t = input ("How long is the test? ") #var that sets the timer length in seconds station = raw_input ("Which test station is running? ") #var that sets which test station is running while t >0: #simple "while" loop that will check the amount of time left, it checks once a second print t, "seconds left" t -=1 time.sleep(1) print "Test on", station, "complete." def again(): # ideally a way to make the timer run again w/o leaving the script rerun = raw_input ("Would you like to re-run this timer? Y or N ") if rerun =="Y" or "y": testTimer() else: print "Great! Test on ", station, "is complete! Check the results and move on!" testTimer() again()
Not very complex and it currently only runs in the command line. My next goal is to make it store the inputs so that it can re run the timer with only one command. I’m thinking maybe some futzing with conditionals and functions will get me closer.