如何旋转 python 乌龟对象
how can I rotate a python turtle object
我需要 h_roof 向左旋转 90 度。我曾尝试使用 h_roof.degrees(90) 但它什么也没做。这是我的代码
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")
我知道我需要添加一些东西,但我不确定是什么。
来自 docs
将海龟向左转角度单位。 (单位默认为度数,但可以通过 degrees() 和 radians() 函数设置。)角度方向取决于海龟模式,参见 mode()。
turtle.left(90)
您可以使用以下功能。
Object.right(角度)或object.left(角度)
turtle.right(90)
或
turtle.left(90)
我需要 h_roof 向左旋转 90 度。我曾尝试使用 h_roof.degrees(90) 但它什么也没做。这是我的代码
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")
我知道我需要添加一些东西,但我不确定是什么。
来自 docs
将海龟向左转角度单位。 (单位默认为度数,但可以通过 degrees() 和 radians() 函数设置。)角度方向取决于海龟模式,参见 mode()。
turtle.left(90)
您可以使用以下功能。 Object.right(角度)或object.left(角度)
turtle.right(90)
或
turtle.left(90)