Software: Pygame

Software: Pygame

Pygame is a set of libraries for Python providing graphics sound, keyboard, mouse and joystick support. I don’t have a keyboard, mouse or joystick in my project, but graphics and sound are exactly what I need to assist my project.

Originally it was written for games, but that doesn’t mean it can’t be used for other things, like an electronic art project. I’ll briefly describe the facilities I use in Pygame.

Graphics wise, Pygame implements surfaces and sprites. On games, surfaces are backgrounds, and sprites are the characters that run around. For this project, I don’t need sprites, but I make heavy use of surfaces. The surfaces are gradually assembled from a background, pictures and text, then displayed. Pygame describes surfaces here.

Photos are loaded onto a surface using Pygame’s image method, graphic lines and shapes can be drawn with the draw method, and text can be added with the older font method or the newer freetype method.

For sound, there are two methods: mixer.Sound for short sounds, and mixer.music for longer sounds. You can play quite a few sounds via the mixer.Sound method, but only one via mixer.music at a time.

There are of course a load of other methods, but they are the main ones I use. I’ve not had any real problems using Pygame, it works, as stated, with no unexpected surprises, which is exactly what I want.