I have an image (QR image) that i have to display it, and keep refreshing it every time. I tried many solutions but none worked, this is my code:
def QRDisplayer():
global displayQR #I tried a tutorial wrote like this line, with it or without nothing changes
path = getcwd() + r"\temp\qr.png"
try:
displayQR.configure(image=PhotoImage(file=path))
except: pass #I used try/except to avoid errors incase the image doesn't exists
root.after(1000, QRDisplayer)
#main window:
root = Tk()
loadConfig()
root.title("")
root.resizable(False, False)
root.geometry("700x500")
displayQR = Label(root,image = None) #None bc it doesn't exists yet
displayQR.pack()
QRDisplayer()
if __name__ == "__main__":
root.mainloop()
the image doesn't display at the first time, bc it's not exists, then I have to start refreshing the element until the photo shows up after reading. Also the photo is changeable so I have keep reading the file and displaying the content.
i spent 6h working on it, nothing worked including:
Python Tkinter Label redrawing every 10 seconds
Tkinter Reloading Window displaying an Image
Tkinter.Misc-class.html#update
Tkinter.Misc-class.html#update_idletasks
also I tried loops with Label["image"]=...
..., and threading lib.