[Image-SIG] PIL and Tk PhotoImage
mark brady
brady@mmm.com
Mon, 15 Jan 2001 16:32:45 -0800
The following simple program is supposed to read an image
using PIL and then convert it into a Tkinter PhotoImage (Running
on a Mac):
from Image import *
from Tkinter import *
im = open("lena.jpg")
im.load()
tkIm = PhotoImage(im)
Instead, it chokes on the last line, giving the following error message:
Traceback (most recent call last):
File "Macintosh HD:Applications:Python 2.0:MyToys:MakeTkImage", line
6, in ?
tkIm = PhotoImage(im)
File "macintosh hd:applications:python 2.0:lib:lib-tk:Tkinter.py",
line 2974, in __init__
apply(Image.__init__, (self, 'photo', name, cnf, master), kw)
File "macintosh hd:applications:python 2.0:lib:lib-tk:Tkinter.py",
line 2915, in __init__
raise RuntimeError, 'Too early to create image'
RuntimeError: Too early to create image
Why is it too early to create the image?
-Mark