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

Data Strategist at Statso. My aim is to decode data science for the real world in the most simple words.

Articles: 1610

Leave a Reply

Discover more from thecleverprogrammer

Subscribe now to keep reading and get access to the full archive.

Continue reading