-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.py
More file actions
29 lines (25 loc) · 763 Bytes
/
clock.py
File metadata and controls
29 lines (25 loc) · 763 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
28
29
from tkinter import *
from datetime import datetime
bgc = '#008aff'
begin = datetime(2016,3,13,0,31)
end = datetime(2016,3,16,1,30)
def update_text():
delta = begin - datetime.now()
if delta.days < 0:
delta = end - datetime.now()
if delta.seconds > 60:
s = '%02d:%02d:%02d' % ((delta.days*24 + delta.seconds//3600), (delta.seconds//60)%60, delta.seconds%60)
else:
s = '%d seconds' % delta.seconds
txt.set(s)
root.after(500, update_text)
root = Tk()
root.resizable(width=FALSE, height=FALSE)
root.title('Countdown Timer')
root.configure(background=bgc)
root.geometry('1920x400')
txt = StringVar()
w = Label(root, bg=bgc, textvariable=txt, font=("Roboto", 240), fg='white')
w.pack()
update_text()
root.mainloop()