Again, Downloading and Displaying an Image from the Internet in Tkinter

Fredrik Lundh fredrik at pythonware.com
Tue Jun 6 16:01:35 CEST 2006


Dustan wrote:

> Ok, that worked (was it plain w or the writelines/readlines that messed
> it up?).

the plain "w"; very few image files are text files.

 > But Tkinter still can't find the image. I'm getting an error
> message:
> 
> TclError: image "C:\Documents and [pathname snipped]" doesn't exist
> 
> If it makes a difference, I'm on a Windows XP machine, and don't have
> to go cross-platform.

the "image" option takes a PhotoImage object, not a file name:

     http://effbot.org/tkinterbook/photoimage.htm

note that the built-in PhotoImage type only supports a few image 
formats; to get support for e.g. PNG and JPEG, you can use PIL which 
ships with it's own PhotoImage replacement:

     http://effbot.org/imagingbook/imagetk.htm

</F>




More information about the Python-list mailing list