Python Digital Clock Project

Python Digital Clock Project:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

(1) Open the PyCharm code editor and create a new project in it. We named the project To build a Digital Clock in Python we need to install the package. For this open the terminal in PyCharm and install one package i.e. tkinter. You install this package by simply typing in the terminal following command i.e. pip install tk and then press enter as shown below.

pip install tk for digital clock

Note: f the package shows an error while using in the code, you can simply install the package by clicking on the red bulb which appears below the error and you can directly install the package from here.

(2) Now write the following code for creating Python Digital Clock Project as shown below.

Python Digital Clock Code 1
Python Digital Clock Code 2

Python Digital Clock Project Source Code:

from tkinter import *
from time import *

def update():
time_str = strftime("%I:%M:%S %p")

day_str = strftime("%A")

date_str = strftime("%B %d, %Y")


clock_window = Tk()
clock_window.title("Digital Clock")

time_label=Label(clock_window,font=("Open Sans",40),bg="#CCE3DE",fg="#00296B")

day_label=Label(clock_window,font=("Open Sans",30),bg="#00296B",fg="#CCE3DE")

date_label=Label(clock_window,font=("Open Sans",20),bg="#CCE3DE",fg="#00296B")



(3) After running the code, the output window will pop us as shown below.

python digital clock

Tutorial MySQL
Tutorial Python
Tokens in C++
Database Management System (DBMS)
Applications of Computer
Basic Components of Computer System
Python (programming language)– Wikipedia

Comments (No)

Leave a Reply