Skip to content

Commit ab96d7b

Browse files
committed
Added Clocky.py
1 parent 082206a commit ab96d7b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Clocky.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import tkinter as tk
2+
from tkinter import font
3+
import time
4+
5+
def update_clock():
6+
#current_time = time.strftime("%H:%M:%S")
7+
current_time = time.strftime("%I:%M:%S %p")
8+
clock.config(text=current_time)
9+
clock.after(1000, update_clock)
10+
11+
root = tk.Tk()
12+
root.overrideredirect(True)
13+
root.geometry("110x40+0+0")
14+
root.lift()
15+
root.wm_attributes("-topmost", True)
16+
root.config(bg='white')
17+
root.attributes("-alpha", 0.8)
18+
19+
clock = tk.Label(root, font=("calibri", 15, "bold"), bg='white')
20+
clock.pack(fill="both", expand=True)
21+
22+
# Add borders
23+
clock.config(bd=2, relief="solid")
24+
25+
# Position the window at the top-right corner
26+
root.geometry("+%d+%d" % (root.winfo_screenwidth()-110, 0))
27+
28+
update_clock()
29+
root.mainloop()

0 commit comments

Comments
 (0)