The Invent with Python Blog

Writings from the author of Automate the Boring Stuff.



Thu 20 June 2013

Decimal, Binary, and Hexadecimal Odometers

Posted by Al Sweigart in programming   

It can be difficult to see how other number systems (such as binary and hexadecimal) work since they have a different amount of numerals than the ten numerals of decimal. But imagine that you are counting in these number systems using an old-fashioned analog odometer that has a different amount of numerals for each digit.

Read more...












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 17 August 2012

How Does Compression Work?

Posted by Al Sweigart in programming   

"Zip" programs that can compress multiple files into one smaller .zip file are fairly popular for downloads since the fewer bytes you have to download the faster it will download. But how do you compress files? Files are made up of ones and zeros, which can't be squished like clothes into a tight suitcase.

Read more...