turtle.seth() function in Python
The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
turtle.seth()
This method is used to set the orientation of the turtle to to_angle. This method requires only one argument as an angle.
These two are the Aliases – setheading, seth for this method.
Syntax : turtle.seth(to_angle) or turtle.setheading(to_angle)
Argument:
to_angle: a number (integer or float)
Set the orientation of the turtle to to_angle. Here are some common directions in degrees (standard – mode) :
- 0 – east
- 90 – north
- 180 – west
- 270 – south
Below is the implementation of the above method with an example :
Example:
Python3
# import packageimport turtle # set direction at 0# angle using sethturtle.seth(0) # motionturtle.forward(80)turtle.write("East") # back to hometurtle.home() # set direction at 90# angle using sethadingturtle.setheading(90) # motionturtle.forward(80)turtle.write("North") # back to hometurtle.home() # set direction at 180# angle using sethturtle.seth(180) # motionturtle.forward(80)turtle.write("West",align="right") # back to hometurtle.home() # set direction at 270# angle using setheadingturtle.setheading(270) # motionturtle.forward(80)turtle.write("South") # hide the turtleturtle.ht() |
Output :




