函数封装绘制菱形:
import turtle as t
def draw():
angles=[0,30,60,90,120,150,180,210,240,270,300,330,360]
l=60*(3**0.5)
colors=["yellow"]
t.begin_fill()
t.fillcolor(colors[0])
t.seth(angles[i])
t.forward(180)
t.right(30)
t.forward(l)
t.left(60)
t.forward(l)
t.left(120)
t.forward(l)
t.left(60)
t.forward(l)
t.goto(0,0)
t.end_fill()
for i in range(12):
draw()
t.exitonclick() #turtle执行完后保留那个页面
标签:turtle,60,菱形,forward,绘制,花式,left
From: https://www.cnblogs.com/JK8395/p/16793330.html