Coders Packet

Create a digital clock in Python

By Siddhant prabhakar

This Program creates a digital clock in Python. You can use VS code or Pycharm. import tkinter module for this Program.

from tkinter import *
import time

def siddhant(t1=""):
    t2=time.strftime("%H:%M:%S")
    if t2!= t1:
        t1=t2
        clock.config(text=t2)
        clock.after(20,siddhant)
l=Tk()
clock=Label(l,font="times 15 bold")
clock.pack(fill="both",expand=2)
siddhant()
l.mainloop()

 

tkinter is most commnlu used GUI method. 

To create tkinter app-

1.import tkinter module.

2. import the container.

3. Add any widget of your choice and apply that event trigger on that widget.

Download project

Reviews Report

Submitted by Siddhant prabhakar (siddhant142)

Download packets of source code on Coders Packet