Cannot See Tkinter Image in Window

While using PhotoImage object in Tkinter, the reference must be held. Tkinter does not handle references to the objects truly. If you do not use your own reference, Tkinter just makes the image transparent, just a blank screen.

As an example;

When we write the code without the reference like;

My “caution.gif” seems like;

But only with a line that keeping a reference to the Tkinter object;

Now I can see my “caution.gif” 😊✌

Leave a Reply