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.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content