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

Default image
Aman Kharwal

I am a programmer from India, and I am here to guide you with Data Science, Machine Learning, Python, and C++ for free. I hope you will learn a lot in your journey towards Coding, Machine Learning and Artificial Intelligence with me.

Leave a Reply