Python Forum
tkinter: Image to Label
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter: Image to Label
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.

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter showing image in button rwahdan 3 127 Jun-16-2021, 06:08 AM
Last Post: Yoriz
  tkinter button image Nick_tkinter 4 563 Mar-04-2021, 11:33 PM
Last Post: deanhystad
  tkinter destroy label inside labelFrame Nick_tkinter 2 449 Feb-24-2021, 03:31 AM
Last Post: deanhystad
  how to resize image in canvas tkinter samuelmv30 2 1,881 Feb-06-2021, 03:35 PM
Last Post: joe_momma
  Latex image too big on tkinter using sympy 4096 1 597 Nov-05-2020, 08:05 AM
Last Post: DPaul
Photo Tkinter TEXT background image _ShevaKadu 5 2,202 Nov-02-2020, 10:34 AM
Last Post: joe_momma
  Tkinter - How can I extend a label widget? TurboC 2 610 Oct-13-2020, 12:15 PM
Last Post: zazas321
  Scrollable big image in a window (TKinter) Prospekteur 3 733 Sep-14-2020, 03:06 AM
Last Post: Larz60+
  Tkinter: How to assign calculated value to a Label LoneStar 7 834 Sep-03-2020, 08:19 PM
Last Post: LoneStar
  Adding an image to a tkinter window djwilson0495 2 2,430 Aug-23-2020, 11:07 AM
Last Post: ebolisa

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020