Как обратиться к переменной в функции класса?
class App(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.start()
def callback(self):
self.root.quit()
def run(self):
self.root = Tk()
self.root.protocol("WM_DELETE_WINDOW", self.callback)
self.root.geometry("1600x900")
self.LBL_ozon = Label(text = parse(), font = "Calibri 100")
self.LBL_ozon.place(x=100,y=100)
self.BTN_confirm_bet = Button(text = "✔", font = "arial 20")
self.BTN_confirm_bet.place(x=400,y=300)
self.ENT_bet = Entry()
self.ENT_bet.place(x=130,y=300)
self.root.mainloop()
app = App()
def refresh_LBL_ozon():
while True:
App().LBL_ozon.config(text = parse())
refreshthread = threading.Thread(target = refresh_LBL_ozon)
refreshthread.start()
Ошибка:
Exception in thread Thread-2: Traceback (most recent call last): File "C:\Users\VandenMiner\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\VandenMiner\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\VandenMiner\Desktop\Python\InvestCheker\WithTK\main.py", line 79, in refresh_LBL_ozon app.LBL_ozon.config(text = parse()) AttributeError: 'App' object has no attribute 'LBL_ozon'