[Tkinter-discuss] problem loading images
Jeff Epler
jepler at unpythonic.net
Mon May 31 08:31:44 EDT 2004
You need to convert the image file to a PhotoImage using
ImageTk.PhotoImage()
Something like so:
> >>> from Tkinter import *
> >>> from PIL import Image, ImageTk
> >>> img = Image.open('image.gif')
> >>> root = Tk()
>>> tkImg = ImageTk.PhotoImage(img)
>>> button2 = Button(root, image=tkImg)
Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20040531/678328c6/attachment.bin
More information about the Tkinter-discuss
mailing list