turtle.home() function in Python

Last Updated : 23 Dec, 2025

turtle.home() method moves the turtle back to the origin (0, 0) and sets its orientation to face east (0 degrees). This method is useful when you want to reset the turtle’s position and heading. It does not clear the drawing or reset other turtle properties.

Syntax

turtle.home()

  • Parameters: This method takes no parameters.
  • Returns: It only moves the turtle to the origin and resets its heading.

Example 1: Resetting Position and Heading

This example demonstrates how home() can reset the turtle’s position and orientation after moving and rotating.

Python
import turtle

print(turtle.position())    
turtle.forward(100)  
print(turtle.position())    

turtle.home()  
print(turtle.position())    

turtle.right(90)  
turtle.forward(100)  
print(turtle.position())    

turtle.home()  
print(turtle.position())    

turtle.done()

Output

(0.0, 0.0)
(100.0, 0.0)
(0.0, 0.0)
(0.0, -100.0)
(0.0, 0.0)

Explanation:

  • turtle.forward(100): Moves turtle in current heading (east by default).
  • turtle.home(): Returns turtle to (0, 0) and faces east.
  • turtle.right(90): Rotates turtle 90° clockwise (now facing south).
  • Demonstrates how home() can be called multiple times to reset position and heading.

Example 2: Using home in Drawing Pattern

This example shows how home() can help in drawing repeated patterns by resetting the turtle to origin before each iteration.

Python
import turtle

turtle.speed(10)

def draw_petal():
    turtle.circle(50, 180)
    turtle.right(90)
    turtle.circle(50, 180)

for i in range(12):
    draw_petal()
    turtle.up()
    turtle.home()
    turtle.down()
    turtle.left(30 * (i+1))

turtle.done()

Output

Explanation:

  • draw_petal: Draws a semi-circular petal shape.
  • turtle.up() and turtle.down(): Control pen to avoid unwanted lines.
  • turtle.home(): Resets turtle to origin before drawing the next petal.
  • turtle.left(30 * (i+1)): Rotates turtle so petals are evenly spaced (360° ÷ 12 = 30°).
  • This creates a circular floral pattern centered at (0, 0).
Comment
Article Tags:

Explore