1import turtle
2t = turtle.Turtle()
3
4#Setting Rotation
5t.setheading(0) # This Faces Right
6t.setheading(180) # This Faces Left
7t.setheading(90) # This Faces Up
8t.setheading(270) # This Faces Down
9
10###################################
11# Values are measured in degrees #
12###################################
1import turtle
2t = turtle.Turtle()
3
4# When using t.setheading(), angles start with 0 degrees, which points right.
5# It then goes anti-clockwise, with 90 degrees being up, 180 being left
6# and 270 degrees being down. 360 degrees is back at the start, and thus
7# is the same as 0 degrees. For Example:
8t.setheading(45) # Face the top-right
9# You can also use t.seth()
10t.seth(180) # Face leftwards
11
12# If you want to rotate your turtle relative to its current position,
13# for example you want it to do a 90 degree left turn you can use
14# t.left() and t.right(). Positive values will turn the turtle however many
15# degrees in the direction of the function you're using, whereas negative values
16# would be the equivelent of using the opposite function:
17t.left(90) # Quarter-turn left
18t.right(-90) # Also quarter-turn left
19# You can also use the shorthand functions t.lt() and t.rt()
20t.lt(180) # Face the opposite direction to where the turtle is currently looking
21t.rt(180) # Does exactly the same thing
22
23# If you want to use radians you can use the t.radians() function:
24t.radians()
25# this can be reverted by using:
26t.degrees()
1import turtle
2t = turtle.Turtle()
3
4#Changing Rotation
5t.leftturn(10) # Turns Left 10 Degrees
6t.rightturn(30) # Turns Right 30 Degrees
7
8#############################################
9# t.lt() and t.rt() are also abbreviations. #
10#############################################
1 >>> tp = turtle.pos()
2 >>> tp
3 (0.00,0.00)
4 >>> turtle.setpos(60,30)
5 >>> turtle.pos()
6 (60.00,30.00)
7 >>> turtle.setpos((20,80))
8 >>> turtle.pos()
9 (20.00,80.00)
10 >>> turtle.setpos(tp)
11 >>> turtle.pos()
12 (0.00,0.00)
13