[Tutor] >> Best setup for animation? <<

Harry Kattz gibbs05@flash.net
Wed, 28 Feb 2001 16:04:11 -0600

Greetings Chris & All,

I hit this problem just this Sunday.  Switching out images is much easier
with Label than Canvas.  In fact, it's this easy:

    LabelVar['image'] = OtherImage

The rub is you'll have to write all the event handling logic yourself. :-)

So, you can compose two or more images using PIL and switch them out on the
label.  As long as they're almost identical, its fairly smooth.

I think Tkinter is fine for doing prototypes of this kind of work.  That's
what I'm trying to do.

Good luck,

> Hi again,
>     So, I've been writing a program with Python and Tkinter.  It does
> some simple animation, but it is all procedural.  That is to say, I have
> several agents moving around my canvas, and they all *take turns* moving
> and being re-displayed.  I'm not sure how to do animation the way I
> would do it in directX, which is as follows:
> 1.  Create a primary surface(canvas).
> 2.  Draw everything in its initial state.
> 3.  Process AI.
> 4.  Move everything to its next-frame state on a *hidden* surface.
> 5.  Make the canvas point to the hidden surface, so all moves are seen
> at once.
> Thus, my question is two-fold:
> 1.  Is there a way to create two canvases, and switch between them to
> create a blitting effect?  I have to admit that I'm a little fuzzy on
> exactly how packing works, and maybe there's a way to display all
> updated objects at once with *one* canvas?
> 2.  Before I go much farther, is the Python Tkinter combo the best setup
> for game-type animation?  I've also started looking at wxPython and
> PyGame, which uses something called SDL.
> I'd like to settle on an evironment and really concentrate on the AI.
> I'd stick with Tkinter if only I could get it to blit.
> Thanks in advance for any help (or pointers to help) you can provide,
> Chris
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor