I am using following code to display an image on my Tkinter GUI, but only a blank frame is getting displayed.
import Tkinter as tk class my_gui(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
img = tk.PhotoImage(file=PATH_TO_GIF)
panel = tk.Label(self, image = img)
panel.grid()
app = my_gui()
app.mainloop()
However, the following code works:
import Tkinter as tk
root=tk.Tk()
img = tk.PhotoImage(file=PATH_TO_GIF)
panel = tk.Label(root, image = img)
panel.grid()
root.mainloop()
Any idea what the problem with the first script is?