Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4165cda

Browse files
Merge pull request #1 from Mohitkumar6122/Mohitkumar6122-patch-1
Create digital_clock.py
2 parents 34ebcfe + 50aaae4 commit 4165cda

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Digital Clock/digital_clock.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# use Tkinter to show a digital clock
2+
import time
3+
from tkinter import *
4+
5+
root = Tk()
6+
7+
root.title("Digital Clock")
8+
root.geometry("250x100+0+0")
9+
root.resizable(0,0)
10+
11+
label = Label(root, font=("Arial", 30, 'bold'), bg="blue", fg="powder blue", bd =30)
12+
label.grid(row =0, column=1)
13+
14+
def dig_clock():
15+
16+
text_input = time.strftime("%H:%M:%S") # get the current local time from the PC
17+
18+
label.config(text=text_input)
19+
20+
# calls itself every 200 milliseconds
21+
# to update the time display as needed
22+
# could use >200 ms, but display gets jerky
23+
24+
label.after(200, clack)
25+
26+
dig_clock()
27+
28+
root.mainloop()

0 commit comments

Comments
 (0)