-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclock.py
26 lines (17 loc) · 843 Bytes
/
clock.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
import datetime
import tkinter as tk
from guisettings import *
class ClockWidget(tk.Frame):
def __init__(self, root, *args, **kwargs):
tk.Frame.__init__(self, root, *args, **kwargs)
self.root = root
self.now = datetime.datetime.now()
self.time_now = self.now.strftime("%X")
self.timeLabel = tk.Label(self, text=self.time_now, font = ('arial', LABEL_FONT_SIZE, 'bold'), background = "#" + BACKGROUND)
self.timeLabel.grid()
self.updateClock()
def updateClock(self):
self.now = datetime.datetime.now()
self.time_now = self.now.strftime("%X")
self.timeLabel.configure(text = self.time_now, font = ('arial', LABEL_FONT_SIZE, 'bold'), background = "#" + BACKGROUND)
self.after(200, self.updateClock)