Create a Digital Clock in Python
In this example, we will learn how to create a simple digital clock using the tkinter standard GUI library of Python.
The clock should look like the one below:

The following code creates and displays a digital clock in Python:
from tkinter import Tk, Label, BOTTOM, mainloop
from time import strftime
root = Tk()
root.geometry("500x200")
root.title('Python Clock')
Label(root, font='arial 20 bold').pack(side=BOTTOM)
def time():
string = strftime('%H:%M:%S %p')
mark.config(text=string)
mark.after(1000, time)
mark = Label(root,
font=('calibri', 50, 'bold'),
pady=720,
foreground='black')
mark.pack(anchor='center')
time()
mainloop()