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")
LBL_ozon = Label(text = parse(), font = "Calibri 100")
LBL_ozon.place(x=100,y=100)
BTN_confirm_bet = Button(text = "✔", font = "arial 20")
BTN_confirm_bet.place(x=400,y=300)
BTN_refresh = Button(text = "Обновить значение", command = lambda:LBL_ozon.config(text = parse()), font = "Calibri 30")
BTN_refresh.place(x=600,y=150)
ENT_bet = Entry()
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'