Countdown timer


Display countdown in seconds in a Label.
Countdown value showing in Label


Tkinter window to show count down value in a Label by starting from a fixed value
import tkinter  as tk 
my_w = tk.Tk()
my_w.geometry("350x170")  # width and height of the window

counter=11 # Initital value of counter
def my_time():
    global counter
    counter=counter-1 # decrease value by 1 
    if counter < 0:
        return
    
    l1.config(text=str(counter)) # Update the label text using string
    l1.after(1000,my_time) # time delay of 1000 milliseconds 
	
my_font=('times',76,'bold') # display size and style
l1=tk.Label(my_w,font=my_font,bg='yellow',width=2)
l1.grid(row=1,column=1,padx=50,pady=30)

my_time() # call the function 
my_w.mainloop()    

Adding Reset button

Countdown with Reset button


To start the counter again from any value , we can add one reset button. Place this code above the line my_w.mainloop()
def restart():
    global counter
    counter=11 # start value 
    my_time() # call the function 
    
b1=tk.Button(my_w,text='Restart',font=22,command=lambda:restart())
b1.grid(row=1,column=2,padx=10)
Analog Clock in Tkinter Canvas

Projects in Tkinter Displaying Calendar to pick date
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



plus2net.com







Python Video Tutorials
Python SQLite Video Tutorials
Python MySQL Video Tutorials
Python Tkinter Video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer