Python | Create a digital clock using Tkinter Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report As we know Tkinter is used to create a variety of GUI (Graphical User Interface) applications. In this article we will learn how to create a Digital clock using Tkinter. Prerequisites: Python functions Tkinter basics (Label Widget) Time module Using Label widget from Tkinter and time module: In the following application, we are going to use Label widget and also going to usetime module which we will use to retrieve system's time.Below is the implementation: Python # importing whole module from tkinter import * from tkinter.ttk import * # importing strftime function to # retrieve system's time from time import strftime # creating tkinter window root = Tk() root.title('Clock') # This function is used to # display time on the label def time(): string = strftime('%H:%M:%S %p') lbl.config(text=string) lbl.after(1000, time) # Styling the label widget so that clock # will look more attractive lbl = Label(root, font=('calibri', 40, 'bold'), background='purple', foreground='white') # Placing clock at the centre # of the tkinter window lbl.pack(anchor='center') time() mainloop() Output: Code Explanation:The code starts by importing the necessary modules.The first module is the tkinter library, which provides basic functionality for creating graphical user interfaces (GUIs).Next, the strftime function is imported to retrieve system time.Next, a window is created and given a title of "Clock."A function called time() is then created to display the current time on the label widget.This function uses the strftime() function to format the time string according to system conventions.The last part of this code sets up styling for the label widget so that it will look nicer.Finally, an instance of Label is created and placed at the center of the window.The time() function is executed, and your output should look like this: Clock: Tue Dec 12 08:00:00 2016The code creates a window and assigns it the title "Clock".The time() function is then called to display the current time on the label widget.The lbl.config() function is used to set the text of the label widget.The after() function is used to delay displaying the time for 1000 milliseconds.Finally, the style of the label widget is modified with lbl.pack(). Create a digital clock using Tkinter Create a digital clock using Tkinter How to Create a Digital Clock Using Python Comment More info S sanjeev2552 Follow Improve Article Tags : Python Python-tkinter Python-gui Explore Python FundamentalsPython Introduction 3 min read Input and Output in Python 4 min read Python Variables 5 min read Python Operators 5 min read Python Keywords 2 min read Python Data Types 7 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 6 min read Python Functions 5 min read Recursion in Python 4 min read Python Lambda Functions 5 min read Python Data StructuresPython String 5 min read Python Lists 4 min read Python Tuples 4 min read Python Dictionary 3 min read Python Sets 6 min read Python Arrays 7 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 5 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 2 min read Python MySQL 9 min read Python Packages 12 min read Python Modules 7 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 3 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 6 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 15+ min read StatsModel Library- Tutorial 4 min read Learning Model Building in Scikit-learn 8 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 6 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 7 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 7 min read Python | Build a REST API using Flask 3 min read How to Create a basic API using Django Rest Framework ? 4 min read Python PracticePython Quiz 3 min read Python Coding Practice 1 min read Python Interview Questions and Answers 15+ min read Like