[Image-SIG] Using PIL

mark mark at diversiform.com
Wed Oct 15 17:41:51 EDT 2003

I feel fairly well versed in getting Tkinter to do what I want, but now
I'm venturing into the whole imaging thing, and placing text and
graphics over some static background image.  Here's the code:
class Imaging:
            def __init__(self, parent):
                        working = self.working = Toplevel(parent)
                        type = gui.mediavar.get()
                        print type
                        if type == 15:
                                    print 'Should see small label'
                                    self.labelimage = 'labelsmall.gif'
                        elif type == 25:
                                    print 'Should see large label'
                                    self.labelimage = 'labelbig.gif'
                        self.img = PhotoImage(file =
'C:/ClearView_Printer/' + self.labelimage)
                        self.width = self.img.width()
                        self.height = self.img.height()
                        self.canvas = Canvas(working, width =
self.width, height = self.height, selectborderwidth = 0)
                        self.canvas.pack(side = TOP, fill = BOTH, expand
= 0)
                        self.canvas.create_image(0, 0, anchor = NW,
image = self.img)
I'm currently getting code reference from Python and Tkinter Programming
by John E. Grayson.  Most of the stuff in there is heavy in image
mapping, but there seem to be some core elements I can use, I just don't
seem to be using them correctly.  This code results in a correctly sized
new window with a gray background, no image.  I can successfully draw
objects in this window, but the .gif image won't display.  I am trying
to avoid using show(), as the manual I read suggests this is only for
debugging purposes.  Of course, using show() lets me see the image.  Any
input would be appreciated.
- Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20031015/34e7f07e/attachment.html

More information about the Image-SIG mailing list