Which Tkinter widget can show jpegs/gifs?

Fredrik Lundh fredrik at pythonware.com
Sat Apr 28 06:41:44 EDT 2001


> Which Tkinter widget can show jpegs/gifs?

Tkinter provides a photoimage object, which can be used with
labels, buttons, text widgets, canvas widgets, etc.

from Tkinter import *

root = Tk()

im = PhotoImage(file="someimage.gif")

w = Label(root, image=im)
w.pack()

mainloop()

the standard photoimage implementation supports GIF and PPM
images.  for some 30 other formats, you can use PIL's ImageTk
module:

    http://www.pythonware.com/products/pil

Cheers /F





More information about the Python-list mailing list