I would like to display the time inside of a tkinter frame in a stylish way, like this :
However I can't find any way to do this, please note the label with the time is centered on my frame. I've also tried putting 2 labels on the same grid cell but the label with hours and minutes is removed when I add the label with the seconds. Is there a way to put 2 labels in one ? or group them ?
class MainPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent, background = "black")
self.root = parent
self.columnconfigure(0, weight = 1, uniform = "x")
self.columnconfigure(1, weight = 1, uniform = "x")
self.columnconfigure(2, weight = 1, uniform = "x")
self.rowconfigure(0, weight = 1, uniform = "x")
self.rowconfigure(1, weight = 1, uniform = "x")
self.HM = tk.Label(self, text = getHM(), fg = "white", bg = "black", font = LARGE_FONT)
self.HM.grid(row = 0, column = 1, pady=10, sticky = 'nwe')
self.S = tk.Label(self, text = getS(), fg = "white", bg = "black", font = LARGE_FONT)
self.S.grid(row = 0, column = 1, pady=10, sticky = 'nwe')
self.update_clock()
def update_clock(self):
HM = "10:20:"
S = "45"
self.HM.configure(text=HM)
self.S.configure(text=S)
self.root.after(1000, self.update_clock)
Thanks in advance ! Shraneid