graphics with python?

Started by
5 comments, last by georgek 15 years, 10 months ago
I'm currently pretty far into learning python and after a lot of experimentation I would like to move onto making games that have graphics (not just ASCII text). What should I learn to use to accomplish this. I was Thinking about PyGame but I don't know of any alternatives. My games would be things like pong or tetris nothing 3D. It would be appreciated if you post recomended books or tutorials if you reply.
---------------------------------------------------------------------------------------Exercise, eat right and be the best you can be!Translation: Play video games for finger streangth and eat lots of hot pockets to be at top programming efficiency.
Advertisement
PyGame is good. Pyglet is another option.
I personally prefer Pyglet because I find that it works better for me, but both work quite well and it is mainly up to personal preference.

As a note, Pyglet can work with OpenGL which allows you to do 3D which you may find to be useful at sometime in the future.

~Cody
Well I read that PyGame can be used in conjunction with PyOpenGL so I'm pretty sure it can do 3D too.
---------------------------------------------------------------------------------------Exercise, eat right and be the best you can be!Translation: Play video games for finger streangth and eat lots of hot pockets to be at top programming efficiency.
Quote:Original post by steveworks
Well I read that PyGame can be used in conjunction with PyOpenGL so I'm pretty sure it can do 3D too.

True, and PyGame and Pyglet are not mutually exclusive. I sometimes use PyGame for easy graphics setup in prototypes, but Pyglet for media playback services. I haven't tried rendering a video processed by Pyglet onto a PyGame surface yet, but I think it's possible.
I'll throw my recommendation in for pyglet. You can write very concise event-driven code with pyglet's high-level classes, subclassing as necessary. I particularly like the event framework. You just make your own classes derive from the event dispatcher and then their custom events can be handled like any other pyglet event.

Using the OpenGL interface requires some knowledge of the ctypes module, but you could use PyOpenGL if that became too much of a pain. With the abstractions already provided you should rarely need to dip down to that "low" level anyway.

If you download pyglet go ahead and get the 1.1 beta since there are some significant changes that will become standard practice with the next release.
A useful reference I've found is the PythonGameLibrary page:

http://wiki.python.org/moin/PythonGameLibraries

This topic is closed to new replies.

Advertisement