python学习笔记:turtle库绘制风轮图形

turtle库绘制风轮图形

使用turtle库,绘制一个风轮效果,其中,每个风轮内角为45度,风轮边长150像素。
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3wQZxLQT-1584157123050)(attachment:image.png)]

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()
发布了51 篇原创文章 · 获赞 34 · 访问量 898

猜你喜欢

转载自blog.csdn.net/weixin_43412569/article/details/104857428