turtle库绘制风轮图形
使用turtle库,绘制一个风轮效果,其中,每个风轮内角为45度,风轮边长150像素。
import turtle as t
#设置画笔
t.setup(600,600)
t.pensize(2)
t.pencolor=(0,0,0)
t.penup()
t.goto(0,-150)
t.pendown()
#画曲线
for i in range(4):
t.pendown()
t.circle(150,45)
t.penup()
t.circle(150,45)
#画直线
t.pendown()
t.goto(0,150)
t.penup()
t.goto(150,0)
t.pendown()
t.goto(-150,0)
t.penup()
t.goto(-106.06601717798,106.06601717798)
t.pendown()
t.goto(106.06601717798,-106.06601717798)
t.penup()
t.goto(106.06601717798,106.06601717798)
t.pendown()
t.goto(-106.06601717798,-106.06601717798)
#结束作画
t.done()