Custom Search

PYTHON: Turtle Graphics

'Turtles' are cursors that are used to produce vector computer graphics upon a Cartesian plane (within x and y axes).

Logo

Turtle graphics was first associated with the computer language 'Logo' in the late 1960s to support the movement of a simple drawing robot.

It was controlled a user's workstation and was designed to carry out the drawing functions assigned to it via a program telling it to lift up/put down the pen and move/turn. It used a small retractable pen that was set into (or attached to) the robot's body to draw on paper placed on the floor.

The original little robot that 'logo' was written for looked a bit like a turtle. Hence the name 'turtle' for the cursor that represented the onscreen position of the robot - and our term for it today.

Turtle geometry works somewhat differently from (x,y) addressed Cartesian geometry, being primarily vector-based. It uses the relative direction and distance from a starting point rather than x and y co-ordinates. So you tell it which way to 'face' and then to move forward or backwards from that position.

This is called using 'turtle geometry'. The turtle is traditionally and most often represented pictorially either as a triangle or a turtle icon (though it can be represented by any icon).

Python

The Python programming language's standard library includes a Turtle graphics module.

Like its Logo predecessor, the Python allows programmers to control one or more turtles in a two-dimensional space.

Since the standard Python syntax, control flow, and data structures can be used alongside the turtle module, 'turtle' has become a popular way for programmers learning Python to familiarize themselves with the basics of the language.

Useful Page Links

Turtle commands

Drawing a cube