import turtle
turtle.setup(800,600)
turtle.pensize(25)
turtle.pencolor('blue')
turtle.penup() #抬笔
turtle.fd(-250)
turtle.pendown() #落笔
turtle.seth(-40)
for i in range(4):
turtle.circle(40,80)
turtle.circle(-40,80)
turtle.seth(0)
turtle.fd(40)
turtle.circle(16,180)
turtle.fd(40*2/3)
turtle.done()
一些turtle的用法:
penup():抬起画笔;
pendown():落下画笔;
pensize(width):画笔宽度;
pencolor(color):画笔颜色;
forward(d)/fd(d):直行d个像素;
circle(r, extent = None):绘制半径为r,角度为extent的弧形,圆心默认在海龟左侧距离r的位置;
setheading(angle)/seth(angle):改变前进方向;
left(angle):海龟左转;
right(angle):海龟右转;