In this post we will learn about How to How to Create a Digital clock using python programming language. In this program we using "tkinter " package.
Tkinter package:
In this Tkinter package used to create a simple GUI (Graphical User Interface). With the help of tkinter framework user can create a simplest graphical user interface elements using the widgets found in the Tk
Digital Clock with Python programming language:
from tkinter import Label, Tk
import time
app_window = Tk()
app_window.title("Digital-Clock")
app_window.geometry("420x150")
app_window.resizable(1,1)
text_font= ("Boulder", 68, 'bold')
background = "#707070"
foreground= "#68f76d"
border_width = 25
label = Label(app_window, font=text_font, bg=background, fg=foreground, bd=border_width)
label.grid(row=0, column=1)
def digital_clock():
time_live = time.strftime("%H:%M:%S")
label.config(text=time_live)
label.after(200, digital_clock)
digital_clock()
app_window.mainloop()(code-box)
Video output :
Output: