-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (25 loc) · 688 Bytes
/
main.py
File metadata and controls
27 lines (25 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from tkinter import *
from time import strftime
def refresh():
chour = strftime('%H')
cmin = strftime('%M')
csec = strftime('%S')
timelabel = ''
chour = int(chour)
if chour >= 12:
chour -= 12
timelabel = 'PM'
elif chour < 12:
timelabel ='AM'
if chour < 10:
chour = str(chour)
chour = '0'+chour
timedisplay.config(text=f'{chour}:{cmin}:{csec} {timelabel}')
root.after(1000, refresh)
root = Tk()
root.title('Digital Clock')
root.config(bg='black')
timedisplay = Label(root, font=('Terminal', 35), bg='black', fg='limegreen')
timedisplay.pack(padx=5,pady=5)
refresh()
root.mainloop()