python画出一个梅花
最新推荐文章于 2021-01-12 13:44:03 发布
weixin_39640520 于 2020-11-20 20:36:57 发布
importturtleimportmathdefp_line(t, n, lenght, angle):for i inrange(n):
t.fd(lenght)
t.lt(angle)defpolygon(t, n, length):
angle= 360 /n
p_line(t, n, length, angle)defarc(t, r, angle):
arc_lenght= 2 * math.pi * r * abs(angle) / 360n= int(arc_lenght / 4) + 1step_length= arc_lenght /n
step_angle= float(angle) /n
t.lt(step_angle/ 2)
p.line(t, n, step_angle,step_length)
t.rt(step_angle/ 2)defpetal(t, n, angle):for i in range(2):
arc(t, r, angle)
t.lt(180 -angle)defflower(t, n, r, angle, p):for i inrange(n):
petal(t, n, angle)
t.lt(p/n)defleaf(t, r, angle, p):
t.bengin_fill()
t.down()
flower(t,1, r, angle, p)
t.end_fill()defmain():
window=turtle.Screen()
window.bgcolor('white')
window.title('Draw a flower')
lucy=turtle.Turtle()
lucy.shape('turtle')
lucy.
相关知识
七夕浪漫表白神器:用Python画出一个会发射爱心的小人
用Python 画出玫瑰图案 (Python经典编程案例)
素描梅花怎么画?如何画出梅花的风骨?
Python画玫瑰花完整代码
python七夕浪漫表白
python 绘制一个四瓣花图
python画皮卡丘并上色代码,用python画皮卡丘的代码
如何使用python画玫瑰花
【Python绘画】花朵
如何用python画玫瑰花
原文链接: python画出一个梅花 https://m.huajiangbk.com/newsview1500581.html
| 上一篇: python turtle 绘制... | 下一篇: 吹一吹,点一点就能画... |



