The Invent with Python Blog

Writings from the author of Automate the Boring Stuff.




Tue 30 October 2012

PygButton - Designing a Button UI Module for Pygame

Posted by Al Sweigart in pygame   

A button is a common user interface (UI) control that is used in many software applications. It seems simple enough: there's a button on the window and you click on it and something happens. But there's a lot of details we should plan out ahead of time. Remember, we want to make a generic button class so that other programmers can use this in their games and programs. Once you've read through the process here, you'll be familiar with how to make your own modules for UI elements.

Read more...




Fri 07 October 2011

Pygame Cheat Sheet

Posted by Al Sweigart in pygame   

If you already know a bit of programming and Python, and want to get up to speed on the Pygame 2D game framework, here's a cheat sheet that you can look over. It implements a very short Pygame program covering most of Pygame's basic features.

Read more...


Sun 18 September 2011

Virtual Caesar Cipher Wheel program

Posted by Al Sweigart in pygame   

The Caesar Cipher Wheel is a paper cutout that can be used to perform encryption and decryption in the Caesar Cipher. However, if you don't have a printer but do have Python and Pygame installed, you can use this Caesar Cipher Wheel program to rotate a virtual cipher disk instead.

Read more...