PIL+Tkinter query (I must be doing something _really_ stupid)

Markus Stenberg mstenber at cc.Helsinki.FI
Tue Jul 13 13:42:43 EDT 1999


Ok, even with the topic, this is a warning: total clueness incoming ;)
>From Markus's adventures in PIL+Tkinter-land..

	from Tkinter import *
	tk = Tk()
	Label(tk, text='foo').pack()
	tk.mainloop()

This works. Ok. (me, a Tcl/Tk guru, snicker)

Then, we add:
	import ImageTK
and change Label to have
	Label(tk, image=ImageTk.PhotoImage(image)).pack()

The image is fine; image.save() produces the required output; it's RGB
image with some map data, to be precise. HOWEVER: The label has correct
size (size of the image) but no image data whatsoever. The same problem
applies to all approaches I've tried (using Canvas and putting it on one,
etc). 

What am I doing incredibly stupidly now? (It _must_ be something trivial,
but..). The s/w used is PIL-1.0b1 with Python 1.5.2.

-Markus

-- 
"...very few phenomena can pull someone out of Deep Hack Mode, with two
noted exceptions: being struck by lightning, or worse, your *computer*
being struck by lightning."
	- Matt Welsh




More information about the Python-list mailing list