码迷,mamicode.com
首页 > 其他好文 > 详细

玫瑰花

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

标签:start   tle   pytho   goto   技术分享   enc   cti   sys   ==   

技术分享

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()

  

 

玫瑰花

标签:start   tle   pytho   goto   技术分享   enc   cti   sys   ==   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!