原标题:使用Python画一朵美丽的玫瑰花
turtle 是 python 中一个强大的绘制图像的库,可以用来绘制各种图像,使用起来很方便。看看本文使用Python的turtle库画一朵美丽的玫瑰花,下面奉上源码。
但是需要计算各种角度、距离等,所以要想完成一幅复杂的图像还是有一定的难度的。
效果图
源码一
from turtle import *
import time
setup(600,800,0,0)
speed(0)
penup()
seth(90)
fd(340)
seth(0)
pendown()
speed(5)
begin_fill()
fillcolor('red')
circle(50,30)
for i in range(10):
fd(1)
left(10)
circle(40,40)
for i in range(6):
fd(1)
left(3)
circle(80,40)
for i in range(20):
fd(0.5)
left(5)
circle(80,45)
for i in range(10):
fd(2)
left(1)
circle(80,25)
for i in range(20):
fd(1)</