Teaching with DrawBot
Python is a great language for introducing the basic concepts of programming to entry level students. There are many tutorials and introduction packages available for the language (see the overview on the python site). DrawBot combines the easy to learn Python with a compact but powerful application in which code, result and feedback are visible at a glance. This section collects scripts and advice on how to specifically use DrawBot in a programming course.
Step by step
Each of the scripts on this page focus on a particular section of Python. Click on the link and copy the text of the script to a new DrawBot window. Read the comments (the lines starting with a #) for clues and help.
Basic math
How do numbers look in Python? how to write simple sums, multiplication, substrations etc.
01-basicmath.py
Strings
Strings contain text, a sequence of letters like beads on a string. This script shows what strings can do.
02-strings.py
Variables
Variables are similar to storage boxes, they need to have a name and contain something. This script shows how to name variables in Python, and some neat tricks they can perform.
03-variables.py
Lists and loops
Lists are sequences of things, like a string is a sequence of letters. But lists can contain things like numbers, variables and other lists. Loops are uses to jump through a list and look at each one of the items. Loops are a powerful and fast way to work with lots of items.
04-listsloops.py
Functions
Functions are small programs with the program. Rather than write something over and over again, you can write a function and recycle the code in different parts of your program.
05-functions.py
Conditions
Sometimes your program needs to respond to particular values or situations. If this value is 4, then go there. If it isn't, just go on.
06-conditions.py
Random numbers
Fun things to do with random numbers. The computer is full of them.
08-randomnumbers.py
Shapes
Drawing a couple of the basic shapes. Have a look at the Drawing Primitives pages for a detailed overview of shapes.
09-shapes.py
Colors
Shapes can also be colored. This script shows how work with shapes in colors and transparency values.
10-colors.py