Tkinter - Image won't show up on button despite keeping global reference Tkinter - Image won't show up on button despite keeping global reference tkinter tkinter

Tkinter - Image won't show up on button despite keeping global reference


The correct way to create the photoimage is by passing the path to the file parameter. Otherwise, your path gets assigned to the internal image name and thus no file will be associated with the image.

photo=tkinter.PhotoImage(file="close.gif")


I typically give PhotoImages a name and use the name in image parameters:

photo=tkinter.PhotoImage(name='close', file="close.gif")close_button.config(image='close')

I'm not sure if this is the only way, but this works here.