Graphical displays with Python and Pygame
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.
[...]
Buy this article as PDF
(incl. VAT)