Digital Clock in Python using Tkinter

Last updated on February 2nd, 2022 at 09:38 pm

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

Jitendra Singh
✔ Verified Educator

Jitendra Singh

Founder of CBSEPython.in

I help CBSE Class 9–12 students learn Python, Information Technology, Artificial Intelligence and Computer Science through easy notes, quizzes, MCQs and sample papers.

Read More About Me →

Leave a Comment

error: Content is protected !!