Python Forum

Full Version: tkinter: Image to Label
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I believe that elfbot link is old tkinter, accepts png, gif. pgm and basex by default if you want to use jpg files you can use PIL or pillow. PIL docs

Pil has a module for using jpg's that should be included on the initial install.
from PIL.ImageTk import Image, PhotoImage
notice the PIL.ImageTk imports Image and PhotoImage -make sure your tkinter import doesn't have any namespace conflicts
another common mistake is to save a reference of the PhotoImage. My common practice is to save it in a list, other wise it will get garbage collected and you won't see the image.
Pages: 1 2