On Wed, Jan 28, 2009 at 8:25 AM, Wayne Watson <sierra_mtnv...@sbcglobal.net> wrote: > I've been playing with PIL and Tkinter a bit, and see that PIL does not have > any facility to view the image file I draw on. I open a file from my folder > with a py program as an Image. The only way, without using some other > module, is to save the changed file, then display it with a paint or photo > program. Is that correct, or did I miss something in PIL?
The ImageTk module integrates PIL with Tkinter: http://effbot.org/imagingbook/imagetk.htm Here is a simple image viewer library, just call showImage() with your loaded Image object: # an image viewer import ImageTk from Tkinter import Tk, Label class UI(Label): def __init__(self, master, im): if im.mode == "1": # bitmap image self.image = ImageTk.BitmapImage(im, foreground="white") Label.__init__(self, master, image=self.image, bg="black", bd=0) else: # photo image self.image = ImageTk.PhotoImage(im) Label.__init__(self, master, image=self.image, bd=0) def showImage(im): root = Tk() UI(root, im).pack() root.mainloop() Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor