Skip to content

Commit 4fbf111

Browse files
authored
Merge pull request #10 from Sscuber03/clock
Made a python clock using tkinter issue#3
2 parents af7939a + d582286 commit 4fbf111

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Python clock/main.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#Before running program, install the ds-digital font fron the link: - https://www.dafont.com/ds-digital.font
2+
3+
# Importing tkinter module
4+
from tkinter import *
5+
from tkinter.ttk import *
6+
7+
# Get system's time
8+
from time import strftime
9+
10+
root = Tk()
11+
root.title('Clock')
12+
13+
# Display time on label
14+
def time():
15+
string = strftime('%I:%M:%S %p')
16+
lbl.config(text=string)
17+
lbl.after(1000, time)
18+
19+
# Font and background color
20+
lbl = Label(root, font=('ds-digital', 80),
21+
background='black',
22+
foreground='cyan')
23+
24+
# Putting the clock in the middle
25+
lbl.pack(anchor='center')
26+
time()
27+
mainloop()

0 commit comments

Comments
 (0)