用python写玫瑰花
时间: 2023-03-13 19:41:20 浏览: 84
用python画浪漫玫瑰花
5星 · 资源好评率100%
用Python写玫瑰花的程序可以参考下面的代码:# 画圆
import turtle
turtle.speed(3)
turtle.penup()
turtle.goto(0,-200)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("pink")
turtle.circle(200)
turtle.end_fill()# 画花瓣
for i in range(36):
turtle.penup()
turtle.goto(0,0)
turtle.setheading(10*i)
turtle.forward(100)
turtle.pendown()
turtle.setheading(150+10*i)
turtle.circle(-50,120)# 画叶子
turtle.penup()
turtle.goto(-80,200)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("green")
turtle.setheading(60)
turtle.circle(80,120)
turtle.setheading(-60)
turtle.circle(-80,120)
turtle.end_fill()turtle.penup()
turtle.goto(80,200)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("green")
turtle.setheading(-60)
turtle.circle(80,120)
turtle.setheading(60)
turtle.circle(-80,120)
turtle.end_fill()turtle.done()
阅读全文