PIL(Pillow) fails with PNG image

Christian Gollwitzer auriocus at gmx.de
Fri Dec 6 07:54:09 CET 2013


Am 05.12.13 21:26, schrieb tastyminerals:
> Hi, I am getting an error when trying to use Pillow library to display
> image PNG  on a Tkinter Button widget. Here is my code.
>
> |image=  Image.open(os.path.join('icons','bulb.png'))  # using PIL for png images
>          self.correctGuessImage=  ImageTk.PhotoImage(image)

I don't know what is the problem here, but Tk supports PNG natively from 
8.5 onwards; just use

	self.correctGuessImage=  ImageTk.PhotoImage(file='bulb.png')

Christian



More information about the Python-list mailing list