Displaying a picture with tkinter

Fredrik Lundh fredrik at pythonware.com
Thu May 17 11:20:46 EDT 2001


Arthur Perlo wrote:
> Thanks, that is a helpful example. But it doesn't solve my problem
> My picture is not in a file. It consists of byte- or integer- pixels
> that have been generated internally in my program. Is there a way I can
> create an image without referring to a file, and download pixel data to it?

try PIL.  something like this might work:

    import Image, ImageTk

    im = Image.new("L", (width, height))
    im.putdata(yourdata)

    photo = ImageTk.PhotoImage(im)

    widget.config(image=photo)

code and documentation here:
http://www.pythonware.com/products/pil/index.htm

Cheers /F





More information about the Python-list mailing list