Digital Clock in Python | Tkinter

Posted by

Below is the code for making live digital clock in Python with Tkinter library.

from tkinter import *
from tkinter.ttk import *
from time import strftime

root=Tk()
root.title("My DIG Clock")
def time():
    string=strftime('%H:%M:%S %p')
    label.config(text=string)
    label.after(1000,time)
    
label=Label(root,font=("ds-digital",80),background="black",foreground="cyan")
label.pack(anchor='center')
time()

mainloop()

Leave a Reply

Your email address will not be published. Required fields are marked *