Here is my code:
from tkinter import *
class app(Tk):
def __init__(self, *args, **kwargs):
Tk.__init__(self, *args, **kwargs)
image = PhotoImage(file="image.gif")
Label(image=image).pack()
window = app()
window.mainloop()
When I run the above code, the image is not displayed. However, when I run the following code...
from tkinter import *
root = Tk()
image = PhotoImage(file="image.gif")
Label(image=image).pack()
root.mainloop()
...the image does show up. Why is this and how can I rectify it?