Pygame is a lightweight framework for creating simple games in Python. You can also think of it as a tool for general multimedia programming; it’s a convenient way to just draw graphics on the screen, play sounds, or handle keyboard and mouse events.
Pygame is a software wrapper around another library called the Simple DirectMedia Layer (SDL). SDL handles all of the low-level access to the Pi’s keyboard, mouse, audio drivers and video drivers. Pygame simplifies SDL even further.
This focus of this chapter is more on the basic multimedia capabilities of Pygame, rather than a tutorial on game programming. Other resources for game programming are provided at the end.
Pygame comes pre-installed ...