[Image-SIG] Moving from Image to Tkinter.PhotoImage
Douglas S. Blank
dblank at brynmawr.edu
Wed Aug 22 02:15:14 CEST 2007
Never mind. It looks like the problem I was having was based on some
code running with one Tk() interpreter, and some other code running in
another. This can happen fairly easily and cause problems in IDLE when
run with subprocesses. The solution was to make sure that objects
created (whether in the shell or in code) use the same root.
Douglas S. Blank wrote:
> I have an image that I have constructed from an array, and need to end up
> as a Tkinter.PhotoImage and I am a little confused as to how I get there.
> I have this working:
> self.array = array( * (height * width * 3), 'B')
> image = Image.frombuffer("RGB", (self.width, self.height), self.array,
> "raw", "RGB", 0, 1)
> but I need to end up with something equivalent to this kind of object:
> pim = Tkinter.PhotoImage(file=filename)
> I've tried ImageTk.PhotoImage(image) and other conversions, but I don't
> get an object with fields and methods like 'blank', 'cget', 'config',
> 'configure', 'copy', 'get', 'height', 'name', 'put', 'subsample', 'tk',
> 'type', 'width', 'write', and 'zoom'.
> What will turn image into a pim?
> Any hints appreciated,
More information about the Image-SIG