10 Free Python Programming Books

August 23, 2008

Below is a collection of 10 great Python programming books that are available online in full, completely free of charge:

Dive into Python

This is a fantastic book that is also available in print. It covers everything, from installing Python and the language’s syntax, right up to web services and unit testing. This is a good book to learn from, but it’s also excellent to use a reference. I frequently find myself visiting the site! If you only read one book on this list make it this one.

An Introduction to Tkinter

Tkinter is a popular cross-platform Python GUI toolkit, and this book provides a good introduction with lots of examples. If you want to learn GUI development with Python then this book is a great place to start.

How to think like a Computer Scientist

This book uses Python to explain some Computer Science principals. It is full of examples, and each chapter has a collection of exercises for the reader to perform.

The Standard Python Library


This book provides a detailed description and usage examples for all of the modules in Python’s standard library. This fantastic reference is available in print.

Invent Your Own Computer Games with Python

This book is aimed at novice programmers who are interested in writing simple computer games. Each chapter describes a different game and goes through the stages of design and development. A great book for beginners, but the book lacks more advanced content and doesn’t include any information about Python game development libraries such as PyGame.

The Django Book



Django is a Python web framework (similar to Ruby’s Rails) which “encourages rapid development and clean, pragmatic design”. This book covers the framework in detail, and is a great place to start if you’re thinking about creating a dynamic website using Python. This book is also available in print

The Pylons Book

Pylons is another Python web framework. The book is structured in a very similar way to the Django book, and is worth reading if you’re looking for an alternative framework. This book is available in print too.

Data Structures and Algorithms with Object-Oriented Design Patterns in Python

This book provides a thorough introduction to data structures and algorithms using Python. This is definitely not a book for those wishing to learn Python. However, if you want to learn about data structures and algorithms, or you just wish to learn about their implementation in Python, I can’t recommend this book enough.

Building Skills in Python

This book consists of 42 chapters, each packed full of exercises designed to help you build Python programming skills. The book “includes six projects from straight-forward to sophisticated that will help solidify your Python skills”. A great book for those that already know Python, but would like to become more proficient.

Building Skills in OO Design

Written by the same author as the book above, this book follows the same format. This book focuses on object-oriented application design (using Python, of course) to help you to develop better programs.

More free books…

Above are just some examples of the books that you can find online. Back in January I posted a list of free computer science books, and I’ve managed to find lots more since then! I’ll post about them soon, so be sure to subscribe to my RSS feed.

PNG2GIF: Convert PNG images to GIF

August 21, 2008

The PNG image file format is vastly superior to GIF, supporting many more colours and better transparency. IE6, however, doesn’t support PNG transparency without the use of a browser specific hack. Therefore the easiest way to display partly transparent images across multiple browser without the use of a hack is to use a GIF image instead.

The excellent set of free and widely used silk icons from FAMFAMFAM come as a set of over 700 PNG images, and I frequently found myself converting a few icons from PNG to GIF for a web project. Converting more than one or two images at a time quickly gets boring, so I created a Python command line utility, based on the code at Nadia Alramli’s blog, to perform the conversion automatically.

Creating GIF files from all the PNG images in the current directory becomes as simple as:

png2gif *.png

If you want to create the GIF images, and delete the PNG images then:

png2gif -r *.png

And if you’d like to output the GIF images to a different directory then:

png2gif -o gifImages/ *.png

To view a full list of supported options you can run png2gif with -h, which shows:

Usage: png2gif [OPTIONS] <files>

Convert PNG images to GIF format

Options:
-h, --help            show this help message and exit
-o OUTPUTDIR, --outputdir=OUTPUTDIR
Set the output directory in which to put the GIF
images. Defaults to the current directory
-t THRESHOLD, --threshold=THRESHOLD
Set the transparency threshold. Defaults to 0
-r, --replace         Delete the PNG files after converting them to GIF
-v, --verbose         Verbose output

You can download the utility here: png2gif

And you can also download the silk icons in GIF format, as converted by PNG2GIF.