Python绘制小红花

设置turtle的画笔属性

import turtle as tt
pen=tt.Turtle()
pen.pensize(5)#画笔粗细
pen.left(60)
pen.speed(11)#画笔速度
pen.color("#FFC125")#画笔颜色
pen.fillcolor('#FF1493')#填充颜色

 画五瓣花的内圈

pen.begin_fill()#颜色填充起点
for i in range(5):
    pen.circle(50,288)#半径为50,弧度288
    pen.penup()#抬笔
    pen.circle(50,72)#72度弧隐藏
    pen.pendown()#落笔
    pen.left(72)
pen.end_fill()#颜色填充终点

 画五瓣花外花瓣

for i in range(5):
    pen.circle(80,288)
    pen.penup()
    pen.circle(80,72)
    pen.pendown()
    pen.left(72)
pen.end_fill()

 画花的枝干

pen.right(162)
pen.forward(500)
tt.done()

最终效果

你可能感兴趣的:(python)