Game On
Scott Sumner
As its name implies, Pygame is a set of Python modules designed to write games. However, many Pygame modules are useful for any number of projects. We introduce you to a few Pygame modules that you can use to create custom graphical displays for your project.
Pygame modules load, scale, and display existing graphics in traditional bitmap formats. A Python/Pygame script a dozen lines long will show an image from disk; or, with the draw module, you can create your own charts and graphs, annotate photos you've loaded, or overlay a camera image with calculated information.
In this article, I will look at pygame.display
, pygame.rect
, pygame.font
, along with some typical Pygame classes to make your game programming a little easier.
Setting Up Pygame
Most Pygame modules [1] have to be initialized before you can use them. The pygame.init()
submodule can set up absolutely everything, but unless you're actually using everything it is best to initialize modules individually; otherwise, a lot of memory is wasted on unused components.
[...]
Use Express-Checkout link below to read the full article (PDF).