Skip to content

Commit 1d706b2

Browse files
temptemp
authored andcommitted
Added Digital Clock
1 parent 07be280 commit 1d706b2

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

DigitalClock.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# importing whole module
2+
from tkinter import *
3+
from tkinter.ttk import *
4+
5+
# importing strftime function to system time
6+
7+
from time import strftime
8+
9+
# creating tkinter window
10+
root = Tk()
11+
root.title('Clock')
12+
13+
# This function is used to display time on the label
14+
def time():
15+
string = strftime("%H : %M : %S")
16+
lbl.config(text = string)
17+
lbl.after(100, time)
18+
19+
# Styling the label widget so that clock will look more attractive
20+
lbl = Label(root, font = ('calibri', 40, 'bold'))
21+
22+
# Placing clock at the centre of the tkinter window
23+
lbl.pack(anchor = 'center')
24+
time()
25+
mainloop()

0 commit comments

Comments
 (0)