I have an annoying issue. I am trying to create class-based front panel for my application to keep things tidy, but I am having an issue with updating fields in sub-class windows.
In the following code, "main_lbl" is updated correctly, but "dev_lbl", inside Frame_1, is not.
class Frame_1(tk.Frame):
def __init__(self, parent):
tk.Frame.__init__(self, parent)
...
self.dev_lbl = tk.Label(self, text="__init__")
self.dev_lbl.pack(side="top", fill="x", expand=1)
class MainApp(tk.Tk):
def __init__(self, master=None, title="MAIN", size="222x333+100+100"):
super().__init__()
EF = Frame_1(self).pack(side="top", padx=2, pady=2, fill="x", expand=True)
self.main_lbl.tk.Label(self, text="Main init")
self.main_lbl.pack(side="bottom")
#<RUN mainloop()>
self.update_GUI()
self.mainloop()
def update_GUI(self):
update_delay = 10
self.main_lbl["text"] = "updated"
Frame_1(self).dev_lbl["text"] = "updated"
self.after(update_delay, self.update_GUI)
root = MainApp(title="BRIDGE")
I have also tried using tk.StringVar() ... same result.
Advice?
Thank you, Radovan
PS: Actually, I would like the display to be in the separate window. I tried tk.Toplevel:
class ShowVariables(tk.Toplevel):
def __init__(self, parent=None):
super().__init__(parent)
self.parent = parent
self.all_dev_lbl = tk.Label(self.Bot_frame, text="__init__")
self.all_dev_lbl.pack(side="top", fill="x", expand=1)
but that did not work either.