Tkinter "pyimage5 doesn't exist"

Viewed 487

I've looked through several similar questions, but nothing is working. I have a Tkinter program that will open a second window when pressing a button. All of the images in the first window work great, but when I open the second window, I get the folling error message when I to to make a button with images:

_tkinter.TclError: image "pyimage5" doesn't exist

The images are defined and stored like this:

add_icon = PhotoImage(file = 'data/add_icon.gif'), subtract_icon = PhotoImage(file = 'data/subtract_icon.gif')

And they are called like this:

Button(edit, image = add_icon, command = add_new_pref, relief = FLAT) .grid(row = 2, column = 0, sticky = NSEW) Button(edit, image = subtract_icon, command = remove_pref, relief = FLAT) .grid(row = 3, column = 0, sticky = NSEW)

The images are defined after the creation of the new window. Any ideas?

0 Answers
Related