-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-clock.py
More file actions
49 lines (36 loc) · 1.36 KB
/
Copy pathpython-clock.py
File metadata and controls
49 lines (36 loc) · 1.36 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import tkinter as tk
from time import strftime
PRISM_UW = 3500
# Tkinter Window
window = tk.Tk()
window.geometry('740x230+' + str(PRISM_UW) + '+400')
window.title("PyClock")
window.configure(background='black', pady=15)
window.overrideredirect(True)
window.bind('<Escape>', lambda e: window.destroy())
def time():
string = strftime('%I|%M|%S %p')
time_label.config(text=string)
time_label.after(1000, time)
def date():
date_main_label.config(text=strftime('%a, %d %b %Y '))
week_label.config(text=strftime('W%W '))
day_label.config(text=strftime('D%j'))
# Corrected target function to date
window.after(1000, date)
# UI
time_label = tk.Label(window, font=('DepartureMono Nerd Font Mono', 70), background='black', foreground='white')
time_label.pack()
# Date Container Frame (allows individual element coloring)
date_box = tk.Frame(window, background='black')
date_box.pack()
font_date = ('DepartureMono Nerd Font Mono', 26)
date_main_label = tk.Label(date_box, font=font_date, background='black', foreground='white')
date_main_label.pack(side='left')
week_label = tk.Label(date_box, font=font_date, background='black', foreground='#00FFFF') # Cyan
week_label.pack(side='left')
day_label = tk.Label(date_box, font=font_date, background='black', foreground='#FF7F50') # Coral
day_label.pack(side='left')
time()
date()
window.mainloop()