python用turtle画雪花

编程入门 行业动态 更新时间:2024-10-12 18:17:54

python用turtle画<a href=https://www.elefans.com/category/jswz/34/1763899.html style=雪花"/>

python用turtle画雪花

这里展示画一些天气图标。记录下来。

首先是晴天的太阳图标, ,

画一个多角形,然后填充。再画个圆形在里面填充。

hideturtle()

color("#FF8C00")

begin_fill()

for i in range(18):

fd(80)

left(100)

end_fill()

up()

goto(40,-8)

down()

color("#FF6347")

fillcolor("#FF6347")

begin_fill()

circle(40)

end_fill()

画云朵图标,先画左边半圆然后画一条直线再画右边半圆,再画上边半圆。

bgcolor('#D3D3D3')

hideturtle()

color("#FFFFFF")

begin_fill()

circle(30,-180)

up()

home()

down()

fd(80)

circle(30,180)

seth(90)

circle(40,180)

end_fill()

画雨滴图标,先画下边半圆,再画右边,然后回画左边,

bgcolor('#D3D3D3')

hideturtle()

seth(-90)

color('#00BFFF')

begin_fill()

circle(20,180)

circle(60,48)

end_fill()

up()

home()

down()

seth(-90)

begin_fill()

circle(60,-48)

end_fill()

画雪花图标,八条线,通过计算(360/8)知道转到那个角度起画各线。

bgcolor('#D3D3D3')

hideturtle()

up()

home()

down()

width(2)

color("#FFFFFF")

for j in range(8):

forward(20)

backward(20)

right(45)

画冰雹图标,画一个五边形。(360/5=72)

bgcolor('#D3D3D3')

hideturtle()

up()

home()

down()

color('#00BFFF')

begin_fill()

for i in range(5):

fd(30)

left(72)

end_fill()

画雷电图标,先画下边的三角形(正弦定理),再上边画一个平行四边形,

bgcolor('#D3D3D3')

hideturtle()

up()

home()

down()

color('#FF8C00')

#下

begin_fill()

seth(60)

fd(40)

seth(180)

up()

home()

down()

seth(70)

fd(36.86419940427505)

seth(0)

fd(7.391701236163814)

end_fill()

#上

begin_fill()

bk(14.391701236163814)

seth(70)

fd(27.391701236163814)

seth(0)

fd(11)

seth(250)

fd(27.391701236163814)

end_fill()

小图标画好了。每个写成方法。开始组合天气图标看看。

晴天:上面太阳图标就可以了。

多云:

阵雨:

阴天:

小雨:

中雨:

大雨:

暴雨:

小雪:

雪:

冰雹:

雷雨:

......

更多推荐

python用turtle画雪花

本文发布于:2024-02-26 21:41:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1704023.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:雪花   python   turtle

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!