forked from larymak/Python-project-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.py
More file actions
31 lines (27 loc) · 878 Bytes
/
clock.py
File metadata and controls
31 lines (27 loc) · 878 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
# import GUI library - Tkinter
import tkinter as tk
import time
class Clock:
def __init__(self):
self.master = tk.Tk()
def settings(self):
# Label the window to "My Clock"
self.master.title('My Clock')
def widgets(self):
#Time calculation
def counttime(time1=''):
time2 = time.strftime('%H:%M:%S')
if time2 != time1:
time1 = time2
clock.config(text=time2)
clock.after(200, counttime)
# Create the clock text
clock = tk.Label(self.master, font=('Poppins', 50, 'bold'), background='blue', foreground='white')
clock.pack(anchor='center')
# Clock loop
counttime()
tk.mainloop()
if __name__ == '__main__':
my_clock = Clock()
my_clock.settings()
my_clock.widgets()