码迷,mamicode.com
首页 > 编程语言 > 详细

python-demo实例

时间:2017-06-05 10:12:42      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:tle   range   div   bsp   pre   lap   rtl   set   size   

1.turtle库与蟒蛇案例

import turtle
def drawSnake(rad,angle,len,neckrad):
    for i in range(len):
        turtle.circle(rad,angle)
        turtle.circle(-rad,angle)
    turtle.circle(rad,angle/2)
    turtle.fd(rad)
    turtle.circle(neckrad+1,180)
    turtle.fd(rad*2/3)

def main():
    turtle.setup(1300,800,0,0)
    pythonsize = 30
    turtle.pensize(pythonsize)
    turtle.pencolor("blue")
    turtle.seth(-40)
    drawSnake(40,80,5,pythonsize/2)

main()

 

python-demo实例

标签:tle   range   div   bsp   pre   lap   rtl   set   size   

原文地址:http://www.cnblogs.com/python-machine/p/6943241.html

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