Robot Turtle with Python

Robot Turtles

Turtle Graphics programs are a cool part of computing history, and a useful way to teach programming.

One of the simpler ways to try out Turtle programming, today, is through the Python Turtle Module.

Getting Ready

Tip: Be sure that Python is installed with the Tkinter module option enabled. This is usually a checkbox during install on Windows. On Linux and Mac it may be a specially named package, such as python3-tk.

sudo apt install python3-tk

Launching the Turtle Program

Type the command python into a terminal. Then, in the interactive Python session, type:

from turtle import *

Now, to list the available commands, type:

dir()

To learn more about a particular command, type use the help function:

help(forward)

Tip: Press Q to exit the help viewer and return to Python.

To display the Turtle window, type your first command:

forward(100)

Tip: A new separate window should appear with an arrow pointing to the right. The tip of the arrow is your turle. The line coming out of the arrow is the 100 points of travel the turtle just completed.

Some interesting commands to explore:

Tip: All commands whould end in () - and some take arguments - text between the ().