I'm trying to show an image multiple times after several button presses, though once I've pressed the button once, and altered the entry input, it no longer updates.
Code:
import tkinter as tk
import qrcode
from PIL import ImageTk,Image
root = tk.Tk()
root.geometry('300x300')
root.resizable(False,False)
root.title('QR-Code Maker')
def create_qrcode(data:str):
qrc = qrcode.make(data,box_size=10)
return qrc
def buttoncallback(entry):
data_for_qrcode = entry.get()
qrc = create_qrcode(data_for_qrcode)
qrc.save('QRCODE.PNG')
img = ImageTk.PhotoImage(Image.open('QRCODE.PNG'))
panel = tk.Label(root,image=img)
panel.pack(side='bottom',fill='both',expand='yes')
root.mainloop()
def main():
entry = tk.Entry(root)
entry.pack(anchor=tk.CENTER)
button = tk.Button(root,text='Genereer QR',command=lambda:buttoncallback(entry))
button.pack(anchor=tk.CENTER)
root.mainloop()
if __name__ == '__main__':
main()
I'm sure I've missed something incredibly obvious, but I cannot for the life of me figure it out