Python GUI app for Clock

Python provides Tkinter to develop GUI applications. Now, it’s upto the skills and imagination of the developer, what he want to develop using tkinter.In this tutorial I will make a simple digital clock GUI application using Tkinter.

#Importing modules
from tkinter import *
from tkinter.ttk import *
from time import strftime
#creating tkinter window
root = Tk()
root.title = ("Time")
# creating function to get time
def time():
    timeformat = strftime(("%H:%M:%S %p"))
    label.config(text=timeformat)
    label.after(1000, time)
# Setting labels to window
label = Label(root, font=("calibri", 35, 'bold'), background='blue',foreground='white')
label.pack(anchor='center')
# to run
time()
mainloop()
#Output

Aman Kharwal
Aman Kharwal

I'm a writer and data scientist on a mission to educate others about the incredible power of data📈.

Articles: 1498

Leave a Reply