首页 > 其他 > 详细

turtle绘制风轮

时间:2021-08-24 09:50:06      阅读:23      评论:0      收藏:0      [点我收藏+]

题目要求:

使用turtle库,绘制一个风轮效果,其中,每个风轮内角为45度,风轮边长150像素。

我的代码:

import turtle
turtle.setup(500,500,100,200)
for i in range(4):
    turtle.fd(150)
    turtle.right(90)
    turtle.circle(-150,45)
    turtle.right(90)
    turtle.fd(150)
    turtle.left(135)
turtle.done()

  

参考答案:

#WindWheel.py
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)

  

turtle绘制风轮

原文:https://www.cnblogs.com/crystalgogogo/p/15178645.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!