Python 3 Tkinter Script to Build Digital Clock GUI Desktop App Using ttkthemes Library
119 views
Jun 3, 2025
Get the full source code of application here: https://codingshiksha.com/python/python-3-tkinter-script-to-build-digital-clock-gui-desktop-app-using-ttkthemes-library/
View Video Transcript
0:00
uh hello guys welcome to this video So
0:02
in this video I will show you how to
0:04
build out a simple digital clock uh kind
0:08
of a desktop application inside
0:10
Trickinter application So let me show
0:12
you the demo here As soon as I launch
0:15
this application it will display the
0:17
current time here in correct format So
0:20
it's 6:56 a.m So you can actually pin
0:25
this
0:26
application So if you're working in
0:30
a if you're working on a laptop then you
0:33
can simply
0:35
uh open this application in the
0:37
background and it will display the
0:39
current date and uh current time here
0:42
like this So inside VS code if you're
0:44
writing code you can actually open this
0:46
application in background It's a simple
0:49
digital kind of a clock kind of an
0:52
application which displays the current
0:54
time in correct format So I will show
0:56
you how to build this application very
0:58
easily inside Python in
1:01
tokinter So all the source code is given
1:03
in the description So first of all you
1:06
need to import the
1:10
tokinter module and it's built in inside
1:14
Python So you import this like this and
1:17
also we import the custom theme of
1:21
tricker like this
1:27
Uh after that we use the time module
1:29
inside Python and from this we import
1:33
this specific
1:36
method to display the time and then we
1:38
initialize the window like this
1:43
TK and then we can actually set some
1:47
properties specifically regarding the
1:49
window which is the title of the
1:53
application which This is digital clock
1:55
and then we define a function time and
1:58
here we
1:59
specifically use this function which is
2:03
that we imported and here
2:05
we provide the which format you want to
2:10
display the time here So this is
2:13
essentially this
2:23
format After that we simply set
2:33
this to the label here Which label you
2:36
want to display this so after each
2:40
second we will be updating the time So
2:43
for this we will just be adding a simple
2:45
label label
2:48
widget to the root window and you can
2:52
use any font of your choice
2:58
So you can set the size and
3:02
bold and then you can set the background
3:05
as well So you can set the background to
3:07
let's suppose yellow and
3:12
uh and then the foreground color you can
3:15
even control it Let's suppose I set it
3:17
to
3:19
black and then we simply add this label
3:22
to the by using the pack method with the
3:26
screen and anchor make it in the center
3:30
position and then we call the time
3:32
method and then call the main loop
3:34
method That's all So this is all that we
3:38
need to do If I again launch this
3:41
application you will see the application
3:43
will look something like this So in this
3:46
easy way you can make a digital clock
3:48
kind of a desktop application inside
3:50
trickenter inside Python Uh thank you
3:54
very much for watching this video and
3:56
also check out my website
3:59
freemediatolsh.com
4:01
uh which contains thousands of tools
#Programming
#Software