[Tutor] RE: PIL

Daniel Yoo dyoo@hkn.EECS.Berkeley.EDU
Tue, 15 Aug 2000 16:59:10 -0700 (PDT)


On Tue, 15 Aug 2000, Nick wrote:

> What do you use for images? send me some code over, i still cant display a
> bitmap yet!!


Dear Nick,

Unfortunately, I have little experience with PIL, so I've forwarded your
message to the tutors at tutor@python.org; they should be better equipped
to answer your question.

PIL, however, is used to create images, but not to display them.  For
display on your screen, you'll want to used a graphics toolkit like
Tkinter.  It's by the same folks at Pythonware, and should already be
installed for you.

I took a quick look at the tkinter documentation, and came up with this
code:


###
from Tkinter import *

photo = PhotoImage(file="freebsd.gif")
canvas = Canvas()
canvas.create_image(photo.width()/2, photo.height()/2, image=photo)
canvas.pack()
mainloop()
###


Again, a warning: I have almost no experience with Tk, so the code above
may be a very dumb way of doing things; hopefully, others on the tutor
list can give better examples.

It sounds like you're interested in doing GUI stuff; in that case, take a
look at:

  http://www.pythonware.com/library/tkinter/introduction/

Again, if you have any questions, feel free to ask tutor@python.org.