-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDigital Clock.py
More file actions
32 lines (26 loc) · 868 Bytes
/
Digital Clock.py
File metadata and controls
32 lines (26 loc) · 868 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
30
31
32
from tkinter import *
from tkinter import ttk
from tkinter import font
import time
import datetime
def quit(*args):
root.destroy()
def clock_time():
time=datetime.datetime.now()
time=(time.strftime("%d-%M-%Y %H:%M:%S"))
#time=(time.strftime("%d-%M-%Y))
#time=(time.strftime("%H:%M:%S"))
txt.set(time)
root.after(1000,clock_time)
root=Tk()
root.title('Your Local Time')
root.attributes("-fullscreen", False)
root.configure(background='black')
root.bind("x", quit)
root.after(1000, clock_time)
fnt=font.Font(family='Western',#'Times','Helvetica','Zapf-Chancery','Western','Courier'
size=15, weight='bold')
txt=StringVar()
lbl=ttk.Label(root, textvariable=txt, font=fnt, foreground="gold", background="black")
lbl.place(relx=0.5, rely=0.5, anchor=CENTER)
root.mainloop()