首页 > 其他 > 详细

玫瑰花

时间:2017-10-27 21:08:33      阅读:271      评论:0      收藏:0      [点我收藏+]

技术分享

import turtle
import sys

turtle.down()
turtle.pencolor(1,0,0)


def leaf(startx ,starty , direction):
    turtle.up();
    turtle.goto(startx,starty)
    turtle.down()
    for i in range(125):
        if direction ==1:
            turtle.forward(2)
            turtle.right(1)
        else:
            turtle.forward(-2)
            turtle.right(-1)
    turtle.up();
    turtle.goto(startx,starty)
    turtle.down();
    for i in range(130):
        if direction ==1:
            turtle.forward(2)
            turtle.right(-1)
        else:
            turtle.forward(-2)
            turtle.right(1)

leaf(50,0,1)
leaf(0,50,1)
leaf(-50,0,1)
leaf(0,-50,1)

turtle.right(70)
turtle.forward(100)
turtle.done()

  

 

玫瑰花

原文:http://www.cnblogs.com/baihang520/p/7745117.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!