Question : root = tk.Tk() my_gui = App1(root)
Answered by : relieved-rabbit-ggtvlux0wuxc
from tkinter import Label, Button
blink = 0
class MyClass(tk.Frame): def __init__(self, master): self.master = master super().__init__(self.master) global blink self.label = Label(master, text=blink) self.button = Button(master, text="Button", command=lambda: foo(self.label)) self.label.pack() self.button.pack() #self.blinkCheck() def blinkCheck(self): global blink while True: print("blink in blinkCheck method is = {}".format(blink)) time.sleep(2.5) def foo(self, label): label.config(text=blink)
Source : https://stackoverflow.com/questions/52572956/passing-variables-into-a-tkinter-class-window | Last Update : Fri, 18 Sep 20