Digital Clock in Python using Tkinter

Source Code:

import time
from tkinter import *

root = Tk()
root.title("Digital Clock")
root.resizable()
lbl = Label(root)
lbl.grid(row=0, column=0)


def display():
    time_get = time.strftime("%Y/%m/%d\n%I:%M:%S %p")
    lbl.config(text=time_get, bg='blue', fg='white',
               font=('Times New Roman', 50, 'bold'))
    lbl.after(100, display)


display()
root.mainloop()

 

Output:

digital clock

Copywrite © 2020-2024, CBSE Python,
All Rights Reserved