本篇文章介绍了python使用turtle库绘制四叶草的方法,代码很简单,希望对学习python的朋友有帮助。
python绘图四叶草import turtle
def draw_shapes():
window = turtle.Screen()
window.bgcolor("red")
flower = turtle.Turtle()
flower.speed(10)
flower.shape("arrow")
flower.right(45)
for i in range(1,37):
for j in range(1,5):
draw_circle(flower,i,"green")
flower.left(90)
flower.right(45)
flower.color("green")
flower.forward(500)
window.exitonclick()
def draw_circle(circle,radius,color):
circle.color(color)
circle.circle(radius)
draw_shapes()
效果图:
以上就是python绘图四叶草的详细内容,更多请关注随便技术网其它相关文章!