Python GUI app for Clock

Creating a GUI application for clock in Python

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

Leave a Reply