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
  Latex image too big on tkinter using sympy 4096 1 218 Nov-05-2020, 08:05 AM
Last Post: DPaul
Photo Tkinter TEXT background image _ShevaKadu 5 1,146 Nov-02-2020, 10:34 AM
Last Post: joe_momma
  Tkinter - How can I extend a label widget? TurboC 2 300 Oct-13-2020, 12:15 PM
Last Post: zazas321
  Scrollable big image in a window (TKinter) Prospekteur 3 352 Sep-14-2020, 03:06 AM
Last Post: Larz60+
  Tkinter: How to assign calculated value to a Label LoneStar 7 473 Sep-03-2020, 08:19 PM
Last Post: LoneStar
  Adding an image to a tkinter window djwilson0495 2 1,224 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  Create image on a Toplevel using tkinter ViktorWong 3 1,919 Jun-13-2020, 03:21 PM
Last Post: deanhystad
  changing tkinter label from thread nanok66 3 849 Jun-07-2020, 01:37 AM
Last Post: nanok66
  [Tkinter] Tkinter Logo Image Evil_Patrick 1 995 May-25-2020, 05:12 AM
Last Post: DT2000
  [Tkinter] Returning always the last image into Label Lucas_Ribeiro 1 600 May-08-2020, 05:56 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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