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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Latex image too big on tkinter using sympy 4096 1 142 Nov-05-2020, 08:05 AM
Last Post: DPaul
Photo Tkinter TEXT background image _ShevaKadu 5 860 Nov-02-2020, 10:34 AM
Last Post: joe_momma
  Tkinter - How can I extend a label widget? TurboC 2 213 Oct-13-2020, 12:15 PM
Last Post: zazas321
  Scrollable big image in a window (TKinter) Prospekteur 3 260 Sep-14-2020, 03:06 AM
Last Post: Larz60+
  Tkinter: How to assign calculated value to a Label LoneStar 7 389 Sep-03-2020, 08:19 PM
Last Post: LoneStar
  Adding an image to a tkinter window djwilson0495 2 775 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  Create image on a Toplevel using tkinter ViktorWong 3 1,647 Jun-13-2020, 03:21 PM
Last Post: deanhystad
  changing tkinter label from thread nanok66 3 675 Jun-07-2020, 01:37 AM
Last Post: nanok66
  [Tkinter] Tkinter Logo Image Evil_Patrick 1 735 May-25-2020, 05:12 AM
Last Post: DT2000
  [Tkinter] Returning always the last image into Label Lucas_Ribeiro 1 542 May-08-2020, 05:56 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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