#绘制蟒蛇
turtle.penup() # 抬起笔
turtle.fd(-250)#向前方运行
#bk()反方向
turtle.pendown() # 落下笔
turtle.pensize(25) # 画笔线条宽度
turtle.pencolor("purple") # 画笔颜色
turtle.seth(-40)#只改变当前行进方向,但不行进
for i in range(4):
turtle.circle(40,80) # 曲线运行,半径为40,旋转角度80
turtle.circle(-40,80)
turtle.circle(40,80/2)
turtle.fd(40)
turtle.circle(16,180)
turtle.fd(40*2/3)
turtle.done()
#绘制矩形
import turtle as t
t.pensize(2)
for i in range(4):
t.fd(150)
t.left(90)
t.done()
# 绘制六边形
import turtle as t
t.pensize(5)
t.pencolor("red")
for i in range(6):
t.fd(150)
t.left(60)
t.done()
import turtle as t
t.pensize(2)
for i in range(4):
t.seth(90*i)
t.fd(150)
t.right(90)
t.circle(-150, 45)
t.goto(0,0)# 指定坐标
|