[Tutor] <NEWBIE> - Need help with displaying graphics in a window

Chris McCormick livelikemad@yahoo.com
Mon, 26 Feb 2001 09:48:36 -0800 (PST)


First off, thanks for reading a newbie post.

Here's my situation:
I'm pretty new at Python (a week or so), though I have
some programming experience, and a pretty good
grounding in oo design.  I'm designing an AI testbed
for fun.  It'll have various agents moving around and
looking for food, hunting each other, reproducing and
whatnot.

So far, I've been doing it all in a text-based manner.
I have a list object representing my map, and I
reprint the map (as a grid of symbols) with each
iteration.

This has gotten to be a major pain.  What I'd really
like to do is switch over to a (very!) simple Tk
window with bitmapped graphics.  

I've spent the last couple of evenings downloading TK
and PIL, getting them set up, reading the docs, and
playing with them.  But for the life of me, I can't
get an image into a Tk window.

If someone could give me some quick source code (or
point to a project in Parnassus) that does the
following things, I'd be immensely grateful:

1.  Create a display window.  Could use any modules,
but I'm using Tk because it seems to be common and
cross-platform.
2.  Display a bitmapped graphic (BMP or JPG, heck,
even PNG) in the window.

Bonus points for examples of surface (canvas?)
flipping or access to a timing function.  I'm using
Python 2.0, Tk 8.3, and Win 98, by the way.

I know this is asking a lot, but I promise I've
scoured the web and haven't found anything good. 
Mostly I get hung up on how to connect PIL to Tk.  I
can create the window with Tk, but then how do I use
PIL to get graphics in there?

Thanks in advance and looking forward to being
Python-literate,
Chris McCormick

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/