so i have this simple app to upload image but now i want every time i upload a new image, the previous image get cleared. Looking for the solution, thanks in advance.
def open():
global my_image
root.filename = filedialog.askopenfilename(initialdir="e:/images", title="Select A File",
filetypes=(("png files", "*.png"), ("all files", "*.*")))
my_label = Label(root, text=root.filename).pack()
my_image = ImageTk.PhotoImage(Image.open(root.filename))
my_image_label = Label(image=my_image).pack()
my_btn = Button(root, text="Open File", command=open).pack()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…