Skip to content Skip to sidebar Skip to footer

I Don't Show The Image In Tkinter

The image doesn't show in Tkinter. The same code work in a new window, but in my class it does not. What could be the problem ? import Tkinter root = Tkinter.Tk class InterfaceA

Solution 1:

You must keep a reference to tr.gif . This means you need to add this line:

imLabel.image = im

After these 2 lines:

im = Tkinter.PhotoImage(file="tr.gif")
imLabel = Tkinter.Label(frPic, image=im)

Other notes:

  • Run import Tkinter as Tk instead of what you have done
  • Fix this: root = Tkinter.Tk() (add parentheses)
  • Change app = InterfaceApp(None) to app = InterfaceApp(root)
  • Remove away app.title("P") and write inside __init__() this self.parent.title("P")
  • Change app.mainloop() to root.mainloop()

Post a Comment for "I Don't Show The Image In Tkinter"