Harrison Pugh
Harrison Pugh

Reputation: 113

how can I rotate a python turtle object

I need h_roof to rotate left 90 degrees. I have tried to use h_roof.degrees(90) but it does nothing. Here's my code

h_roof = turtle.Turtle()
h_roof.speed(0)
h_roof.shape("triangle")
h_roof.shapesize(stretch_len=18, stretch_wid=18)
h_roof.color("#233030")

I know i need to add something but i'm not sure what.

Upvotes: 1

Views: 11648

Answers (2)

Aditya Patil
Aditya Patil

Reputation: 209

You can use following functions. Object.right(angle) or object.left(angle)

turtle.right(90)

or

turtle.left(90)

Upvotes: 2

Mahmoud Farouq
Mahmoud Farouq

Reputation: 423

from the docs

Turn turtle left by angle units. (Units are by default degrees, but can be set via the degrees() and radians() functions.) Angle orientation depends on the turtle mode, see mode().

turtle.left(90)

Upvotes: 3

Related Questions