-
Notifications
You must be signed in to change notification settings - Fork 0
/
count_down.py
35 lines (28 loc) · 913 Bytes
/
count_down.py
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
30
31
32
33
34
35
from tkinter import *
from tkinter import ttk
from tkinter import font
import time
import datetime
global endTime
def quit(*args):
root.destroy()
def cant_wait():
timeLeft = endTime - datetime.datetime.now()
timeLeft = timeLeft - datetime.timedelta(microseconds=timeLeft.microseconds)
txt.set(timeLeft)
if(timeLeft.seconds != 0):
root.after(1000, cant_wait)
else:
root.configure(background='red')
lbl.configure(background='red')
root = Tk()
root.attributes("-fullscreen",False)
root.configure(background='black')
root.bind("x", quit)
root.after(1000, cant_wait)
endTime = datetime.datetime(2021,8,6,6,4)
fnt = font.Font(family='Helvetica',size=90,weight='bold')
txt = StringVar()
lbl = ttk.Label(root,textvariable=txt,font=fnt,foreground='white',background='black')
lbl.place(relx=0.5,rely=0.5,anchor=CENTER)
root.mainloop()