Dvlv/Tkinter-By-Example

Trouble with Loading an Image in Button

Closed this issue · 1 comments

I've tried running code like
self.photo = tk.PhotoImage(file="image1.gif")

and it always says it couldn't find pyimageX.gif. The code is looking for "name=" instead of "file="

Have you made a lot of changes in this area and if so, is there updated documentation? I can't get a button to load an image to save my life. I've also tried:
self.photo = tk.PhotoImage(name="image1.gif")

and it seems to succeed but then the image isn't shown in the button. Suggestions? Thx

Dvlv commented

Hello.

I can't help you much without a proper code sample.

If you'd like to see a working sample, refer to another repository of mine:

https://github.com/Dvlv/Tkinter-Gui-Programming-By-Example-Packt/blob/master/Ch8/smilieselect.py

This class pops up a window with 8 buttons, all with an image.