1.turtle 库

用python turtle画玫瑰-LMLPHP

用python turtle画玫瑰-LMLPHP

2.画玫瑰的代码:

import turtle
turtle.penup()
turtle.left()
turtle.fd()
turtle.pendown()
turtle.right()
turtle.fillcolor("red")
turtle.begin_fill()
turtle.circle(, )
turtle.circle(, )
turtle.left()
turtle.circle(, )
turtle.circle(, )
turtle.right()
turtle.fd()
turtle.left()
turtle.circle(, )
turtle.fd()
turtle.left()
turtle.circle(, )
turtle.circle(, )
turtle.right()
turtle.fd()
turtle.circle(, )
turtle.left()
turtle.fd()
turtle.right()
turtle.fd()
turtle.left()
turtle.circle(, )
turtle.left()
turtle.circle(, )
turtle.end_fill()
turtle.left()
turtle.circle(-, )
turtle.left()
turtle.circle(, )
turtle.setheading()
turtle.circle(, )
turtle.circle(-, )
turtle.left()
turtle.circle(, )
turtle.circle(-, )
turtle.setheading(-)
turtle.fd()
turtle.left()
turtle.fd()
turtle.left()
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(-, )
turtle.right()
turtle.circle(-, )
turtle.end_fill()
turtle.right()
turtle.fd()
turtle.left()
turtle.fd()
turtle.left()
turtle.fd()
turtle.right()
turtle.right()
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(, )
turtle.left()
turtle.circle(, )
turtle.end_fill()
turtle.left()
turtle.fd()
turtle.left()
turtle.fd()
turtle.right()
turtle.circle(, )

对于上面的代码大家可以根据自己的来修改

结果表示如下:

用python turtle画玫瑰-LMLPHP

到此结束...............................................................

04-28 05:24