Absolute Positioning
- The
position
method returns a turtle’s current position. - For newly created turtles, this returns the tuple
(0, 0)
. - A turtle’s position can be changed using absolute positioning by moving the turtle to a specific
(x, y)
coordinate location by use of thesetposition
method.

Relative Positioning
- A turtle’s position can be changed using relative positioning by use of methods setheading, left, right, and forward
Turtle Heading
- When a turtle is newly created, its initial heading is to the right, at 0 degrees.
- A turtle with a heading of 90 degrees moves upwards.
- A heading of 180 degrees corresponds to movement to the left.
- A heading of 270 degrees corresponds to movement downwards.
- A turtle’s heading can be changed by turning the turtle a given number of degrees left,
left(90)
, or right,right(90)
. - The forward method moves a turtle in the direction that it is currently heading
- A turtle’s heading can also be set to a specific heading by use of method setheading: the_turtle.set heading(90).
- In addition, method heading can be used to determine a turtle’s current heading.

Pen Attributes
Pen attributes in turtle graphics control the drawing capabilities of a turtle object.
Pen Up and Pen Down:
- Determines whether the pen is up or down, controlled by
penup()
andpendown()
methods. penup()
: Lifts the pen, allowing the turtle to move without drawing lines.pendown()
: Lowers the pen, enabling the turtle to draw lines as it moves.
Pen Size:
- The width of the lines drawn when the pen is down is determined by the pen size. The pen size is controlled using the
pensize()
method. - The size is specified in pixels and can be adjusted according to requirements.
- For instance,
the_turtle.pensize(5)
sets the pen size to 5 pixels.
Pen Color:
- The color of the lines drawn by the turtle can be selected using the
pencolor()
method. - The colors can be specified using common color names like 'white', 'red', 'blue', 'green', 'yellow', 'gray', and 'black'.
- Alternatively, colors can be specified in RGB (red/green/blue) component values. The range is typically 0–255.
- To utilize the full spectrum of colors, set the color mode attribute of the turtle window using
turtle.colormode(255)
. - For example,
the_turtle.pencolor(238, 130, 238)
sets the pen color to violet using RGB values.