import turtle
t = turtle # 给turtle取别名
t.pensize(2) # 设置画笔粗细
t.hideturtle() # 隐藏 turtle
t.colormode(255) # 切换RGB色彩模式
t.color((0, 0, 0), "Green") # 设置画笔颜色和填充颜色
t.setup(500, 500) # 设置主窗体的大小和位置
t.speed(5) # 定义绘图的速度
t.penup() # 抬起笔
t.goto(0, -100) # 设置海龟绝对坐标
t.pendown() # 落下笔
t.circle(100) # 绘制100像素的圆
t.penup() # 抬起笔
t.goto(-20, 35) # 设置海龟绝对坐标
t.pendown() # 落下笔
t.begin_fill() # 准备填充形状
t.forward(40) # 向前移动40像素
t.seth(-60) # 海龟转向-60
t.forward(40) # 向前移动40像素
t.seth(-120) # 设置窗体的位置和大小
t.forward(40) # 向前移动40像素
t.seth(-180) # 海龟转向-180
t.forward(40) # 向前移动40像素
t.seth(120) # 海龟转向120
t.forward(40) # 向前移动40像素
t.seth(60) # 海龟转向60
t.forward(40) # 向前移动40像素
t.end_fill() # 填充完成
t.seth(120)
t.color((0, 0, 0), (29, 184, 130))
for i in range(6):
t.begin_fill()
t.forward(60)
t.right(90) # 基于当前角度向右转90度
t.circle(-100, 60)
t.right(90)
t.forward(60)
t.right(180)
t.end_fill()
t.penup()
t.goto(-15, 100)
t.seth(90) # 行进方向角度的绝对坐标
t.pendown()
t.forward(15)
t.circle(-15, 180)
t.forward(15)
for i in range(4):
t.penup()
t.goto(0, 0)
if i == 0:
t.seth(35);
if i == 1:
t.seth(-25)
if i == 2:
t.seth(-145)
if i == 3:
t.seth(-205)
t.forward(100)
t.right(5)
t.pendown()
t.forward(10)
t.circle(-10, 180) # 圆心在海龟左侧10像素的圆,180角度
t.forward(10)
t.penup()
t.goto(10, -100)
t.seth(-90)
t.pendown()
t.forward(10)
t.circle(-30, 60)
t.right(150)
t.circle(30, 60)
t.goto(-10, -100)
t.done() # 画面一直停留