Skip to content
Related Articles

Related Articles

turtle.seth() function in Python

Improve Article
Save Article
Like Article
  • Last Updated : 21 Jul, 2020

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 package
import turtle
  
  
# set direction at 0
# angle using seth
turtle.seth(0)
  
# motion
turtle.forward(80)
turtle.write("East")
  
# back to home
turtle.home()
  
# set direction at 90
# angle using sethading
turtle.setheading(90)
  
# motion
turtle.forward(80)
turtle.write("North")
  
# back to home
turtle.home()
  
# set direction at 180
# angle using seth
turtle.seth(180)
  
# motion
turtle.forward(80)
turtle.write("West",align="right")
  
# back to home
turtle.home()
  
# set direction at 270
# angle using setheading
turtle.setheading(270)
  
# motion
turtle.forward(80)
turtle.write("South")
  
# hide the turtle
turtle.ht()

Output :

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!