Open In App

turtle.seth() function in Python

Last Updated : 18 Aug, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

turtle.seth() method sets the orientation (heading) of the turtle to a specified angle in degrees, measured counterclockwise from the positive x-axis (east). The turtle’s position remains unchanged, and only its facing direction is altered. This method is also available through the alias turtle.setheading().

Syntax

turtle.seth(to_angle)
turtle.setheading(to_angle)

Parameters: to_angle (int | float) is the angle to set the turtle’s heading to, in degrees. Common headings in standard mode:

  • 0 : East
  • 90 : North
  • 180 : West
  • 270 : South

Returns: This method only changes the turtle's heading, not its position.

Below is the implementation of the above method with an example :

Python
import turtle

turtle.seth(0)
turtle.forward(80)
turtle.write("East")

turtle.home()
turtle.setheading(90)
turtle.forward(80)
turtle.write("North")

turtle.home()
turtle.seth(180)
turtle.forward(80)
turtle.write("West", align="right")

turtle.home()
turtle.setheading(270)
turtle.forward(80)
turtle.write("South")

turtle.ht()

Output :

Explanation:

  • turtle.seth(angle) / turtle.setheading(angle) : Sets the turtle’s facing direction.
  • turtle.forward(distance) : Moves the turtle forward in the current direction.
  • turtle.write(text, align=…) : Writes text at the turtle’s current position.
  • turtle.home() : Returns the turtle to the origin (0,0) facing East.
  • turtle.ht() : Hides the turtle icon.

Article Tags :
Practice Tags :

Similar Reads