Aug-05-2022, 09:37 PM
You didn't keep a reference to image, so it is garbage collected when the function exits. You can append to a list or create an instance object that survives, like canvas
canvas.image = ImageTk.PhotoImage(pilImage) imagesprite = canvas.create_image(w / 2, h / 2, image=canvas.image)