Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Imaging using PIL

Reply
Thread Tools

Imaging using PIL

 
 
mark
Guest
Posts: n/a
 
      10-13-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. I'm trying to use PIL, but
what I get from this code is a new window with a gray background, not
the image I'm trying to open. 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. Any input would be appreciated.

TIA,

- Mark

 
Reply With Quote
 
 
 
 
Michael Peuser
Guest
Posts: n/a
 
      10-14-2003
"mark" <(E-Mail Removed)>

> 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.
> I'm trying to use PIL, ....


? What has PIL to do wth it?

> ... but what I get from this code is a new window with a gray background,
> not the image I'm trying to open.


The code looks o.k. Maybe width or height are zero (because of some peculiar
GIF problem); in that case the Canvas would be invisible and you would just
see the gray Toplevel...

Kindly
MichaelP


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python Imaging Library (PIL) question Sid Python 2 10-21-2008 11:06 AM
help: setup Python Imaging Library (PIL) for linux server moishyyehuda@gmail.com Python 1 12-13-2006 10:48 PM
can I download Python Imaging Library (PIL) for linux. moishyyehuda@gmail.com Python 2 12-11-2006 06:20 PM
Anaglyph 3D Stereo Imaging with PIL and numpy David Murmann Python 1 05-03-2006 05:29 PM
Retrieve a GIF's palette entries using Python Imaging Library (PIL) Stuart Python 1 01-19-2006 10:51 AM



Advertisments