Tkinter: Update image on Canvas with Button click
Example images
Change only once
Create two ImagePhoto
instances
image1 = tk.PhotoImage(file="ball1.gif")
image2 = tk.PhotoImage(file="ball2.gif")
Put first image on Canvas
and keep its ID
(image_id
).
image_id = canvas.create_image(0, 0, anchor='nw', image=image1)
(Normally it would set center of image in position (0 …