views:

3902

answers:

2

I'm writing a simulator in Python, and am curious about options and opinions regarding basic 2D animations. By animation, I'm referring to rendering on the fly, not displaying prerendered images.

I'm currently using matplotlib (Wxagg backend), and it's possible that I'll be able to continue using it, but I suspect it won't be able to sufficiently scale in terms of performance or capabilities.

Requirements are:

  • Cross-platform (Linux, MacOS X, Windows)
  • Low complexity overhead
  • Plays well with wxpython (at least won't step on each other's toes unduly)
  • Interactivity. Detect when objects are clicked on, moused over, etc.

Note that high performance isn't on the list, but the ability to handle ~100 bitmap objects on the screen would be good.

Your thoughts?

+6  A: 

I am a fan of pyglet which is a completely self contained library for doing graphical work under win32, linux, and OS X.

It has very low overhead, and you can see this for yourself from the tutorial on the website. It should play well with wxpython, or at least I seem to recall posts to the mailing list about wxpython and pyglet being used together.

It however does not offer selection of objects via mouse clicks - this you will have to handle yourself. Generally speaking for a 2D application this is not too difficult to do.

mactorii is an OS X application of mine written in pure python+pyglet, and has some basic animation (scrolling) and click detection. It doesn't use wxpython, but perhaps it will give you an idea of what is involved. Note however mactorii is using the old pyglet api, so the run loop I have in there is obsolete. I will get around to updating it one day... :P

freespace
A: 

You can try pygame, its very easy to handle and similar to SDL under c++