Skip to content

Commit d19d342

Browse files
committed
created a simple clock widget using Tkinter
1 parent cd3b802 commit d19d342

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

UI-Apps/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### SIMPLE CLOCK WIDGET USING TKINTER
2+
3+
## Running instruction
4+
5+
# windows user
6+
run `py clock.py`
7+
8+
# linux user
9+
run `python3 clock.py`

UI-Apps/clock.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import tkinter
2+
# retrieve system's time
3+
from time import strftime
4+
#------------------main code-----------------------
5+
#initializing the main UI object
6+
top = tkinter.Tk()
7+
#setting title of the App
8+
top.title('Clock')
9+
#restricting the resizable property
10+
top.resizable(0,0)
11+
12+
def time():
13+
string = strftime('%H:%M:%S %p')
14+
clockTime.config(text = string)
15+
clockTime.after(1000, time)
16+
17+
18+
clockTime = tkinter.Label(top, font = ('calibri', 40, 'bold'), background = 'black', foreground = 'white')
19+
20+
clockTime.pack(anchor = 'center')
21+
time()
22+
23+
24+
top.mainloop()

0 commit comments

Comments
 (0)