在 Python Turtle 中向后画一个圆圈
Draw a circle backwards in Python Turtle
我要画圆位,不是顺时针画的,画的时候是逆时针画的。我需要它返回与前进的距离大致相同的距离。 (查看代码)
我试过命令 "circle(100, 30)"
import turtle
t = turtle.Pen()
t.speed(0)
def drawKrusty(size):
t.right(90)
t.forward(size)
t.left(90)
t.fillcolor("grey")
t.begin_fill()
for i in range(2):
t.forward(size / 10)
t.left(90)
t.forward(size)
t.left(90)
t.end_fill()
t.left(90)
t.forward(size)
t.right(90)
t.forward(size / 20)
t.circle(size, 30)
t.backcircle(size, 60)
t.end_fill()
drawKrusty(500)
如果将 circle
的 extent
(第二个)参数设置为负值 - 圆弧将沿逆时针方向移动。 t.circle(size, -60)
我要画圆位,不是顺时针画的,画的时候是逆时针画的。我需要它返回与前进的距离大致相同的距离。 (查看代码)
我试过命令 "circle(100, 30)"
import turtle
t = turtle.Pen()
t.speed(0)
def drawKrusty(size):
t.right(90)
t.forward(size)
t.left(90)
t.fillcolor("grey")
t.begin_fill()
for i in range(2):
t.forward(size / 10)
t.left(90)
t.forward(size)
t.left(90)
t.end_fill()
t.left(90)
t.forward(size)
t.right(90)
t.forward(size / 20)
t.circle(size, 30)
t.backcircle(size, 60)
t.end_fill()
drawKrusty(500)
如果将 circle
的 extent
(第二个)参数设置为负值 - 圆弧将沿逆时针方向移动。 t.circle(size, -60)