Title: Signature.html
Thanks. I was beginning to think the only way to get this done is via Tkinter's canvas.

I guess I can see why PIL later became amended with libraries like Tkinter. I think PIL came first, and apparently depended upon some then present elements of Python for displaying images.

Working on the imaging side of Python has been a bit daunting without a good text. My oldish Learning Python is of no help in this area. I've ordered some interlibrary loans through the local library, but they've been slow in coming. The internet is fragmented on this subject. Probably the best is from NM Tech, and your reference here. Nothing cohesive out there. I may have to make a book trip down to the big cities this week. I'll rattle our library about the books. They've been impacted by layoffs.

UI  == Utility Imager?

Kent Johnson wrote:
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

  

--
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
            
         Copper and its alloys have been found effective in hospital
         sinks, hand rails, beds, ... in significantly reducing 
         bacteria. Estimates are 1/20 people admitted to a hospital
         become infected, and 1/20 die from the infection.
                       -- NPR Science Friday, 01/16/2009 

                    Web Page: <www.speckledwithstars.net/>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to