Ten seconds timer?

by: PyLORD, 7 years ago

Last edited: 7 years ago

Hey fellow pythonistas,

I am creating a GUI with tkinter and I want to know how to create a ten seconds. So essentially it's counting down from ten seconds to zero. Once it's zero the application pauses. I'd like to know how I can incorporate the time module with this.



You must be logged in to post. Please login or register an account.



It's a simple program: All you have to do is count numbers. This program counts for ten minutes in descending:

import time
print("This is the timer")
# Ask to Begin
start = raw_input("Would you like to begin Timing? (y/n): ")
if start == "y":
    timeLoop = True

# Variables to keep track and display
Sec = 60
Min = 10
# Begin Process
while timeLoop:
    Sec -= 1
    if not Sec == 0:
     print(str(Min) + " Mins " + str(Sec) + " Sec ")
     time.sleep(1)
    if Sec == 0:
        Sec = 60
        Min -= 1
        print(str(Min) + " Minute")


-s.maximus3 7 years ago

You must be logged in to post. Please login or register an account.