Hello World!

Illustrations

Posted: April 7, 2009 at 5:29 am

If you’ve looked at the book (or even just the cover), you might be wondering about the person who did all the wonderful illustrations. His name is Martin Murtonen. You can find out more about his work at his web site.
Although we worked very closely with Martin to get all the illustrations just right, we never met him, until our Book Launch party, even though we live in the same city! All our collaboration was by phone and e-mail.
That’s one of the things about modern communications, and computers in particular. There are many people who work together or are friends who have never met in person. In fact, we have never met any of the people who worked on our book – editors, typesetters, production staff, and so on (except for a few reviewers who we knew before we started). One day we hope to meet some of the people who made our book come to life!

Read More...

Python Help and Your Modules

Posted: April 6, 2009 at 12:00 am

Warren: In the book, we talked a bit about Python’s help system. This is something that can give you help on using Python’s built-in modules and functions as well as external modules and functions. But we didn’t tell you how to add help to your own modules. In this post, we will. I’m going to let Carter take it from here.
Carter: Hi! It’s Carter here. This blog post is a guide to adding help to your Python modules. We will be starting with our TempConv module from Chapter 15:
# this is the file “my_module.py”# we’re going to use it in another programdef c_to_f(celsius):fahrenheit = celsius * 9.0 / 5 + 32return fahrenheit
First, let’s see what help() brings up in Python:
>>> import my_moduleTraceback (most recent call last):File “”, line 1, in ImportError: No module named my_module

Oops! We forgot that Python can’t find our module unless it’s in a folder where python can find it. Navigate to this folder in Windows Explorer (or your favourite file browser):
C:\Python25\Lib\site-packages\Among other things, you should see a Pygame folder, a PythonCard folder, and easygui.py (you might have to scroll down). Save my_module.py there, restart IDLE (or SPE, or Python Shell), and then try importing it again …

Read More...