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

python画的小乌龟

时间:2018-11-10 23:50:01      阅读:449      评论:0      收藏:0      [点我收藏+]

标签:end   loop   imp   bsp   for   nbsp   down   set   span   

import turtle
turtle.setup(1000,800)
turtle.speed(6)
turtle.colormode(255)
turtle.color((0,0,0),(60,100,30))
turtle.penup()
turtle.goto(0,-200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(200)
turtle.end_fill()
turtle.pensize(2)
turtle.penup()
turtle.goto(190,-60)
turtle.pendown()
turtle.goto(-190,-60)
turtle.penup()
turtle.goto(190,60)
turtle.pendown()
turtle.goto(-190,60)
turtle.penup()
turtle.goto(60,190)
turtle.pendown()
turtle.goto(60,-190)
turtle.penup()
turtle.goto(-60,190)
turtle.pendown()
turtle.goto(-60,-190)
turtle.penup()
turtle.pensize(1)
turtle.goto(20,198)
turtle.penup()
turtle.goto(0,200)
turtle.pendown()
turtle.color((0,0,0),(60,80,30))
turtle.begin_fill()
a=1
turtle.speed(0)
for i in range(120):
    if 0<=i<30 or 60<=i<=90:
        a=a+0.04
        turtle.lt(3)
        turtle.fd(a)
    else:
        a=a-0.04
        turtle.lt(3)
        turtle.fd(a)
turtle.penup()
turtle.end_fill()

turtle.color((0,0,0),(255,255,255))
turtle.goto(11,240)
turtle.begin_fill()
turtle.pendown()
turtle.circle(5)
turtle.end_fill()
turtle.penup()
turtle.end_fill()
turtle.color((0,0,0),(255,255,255))
turtle.goto(-11,240)
turtle.begin_fill()
turtle.pendown()
turtle.circle(5)
turtle.end_fill()
turtle.penup()

turtle.color((0,0,0),(0,0,0))
turtle.goto(10,240)
turtle.begin_fill()
turtle.pendown()
turtle.circle(3)
turtle.end_fill()
turtle.penup()
turtle.end_fill()
turtle.color((0,0,0),(0,0,0))
turtle.goto(-10,240)
turtle.begin_fill()
turtle.pendown()
turtle.circle(3)
turtle.end_fill()
turtle.penup()
turtle.color((0,0,0),(60,80,30))
turtle.goto(-120,150)
turtle.pendown()
turtle.seth(30)
turtle.begin_fill()
a=0.3
for i in range(120):
    if 0<=i<30 or 60<=i<=90:
        a=a+0.06
        turtle.lt(3)
        turtle.fd(a)
    else:
        a=a-0.06
        turtle.lt(3)
        turtle.fd(a)
turtle.end_fill()
turtle.penup()
turtle.goto(120,150)
turtle.pendown()
turtle.seth(-30)
a=0.3
turtle.begin_fill()
for i in range(120):
    if 0<=i<30 or 60<=i<=90:
        a=a+0.06
        turtle.lt(3)
        turtle.fd(a)
    else:
        a=a-0.06
        turtle.lt(3)
        turtle.fd(a)
turtle.penup()
turtle.end_fill()
turtle.goto(-120,-160)
turtle.pendown()
turtle.seth(-210)
turtle.begin_fill()
a=0.5
for i in range(120):
    if 0<=i<30 or 60<=i<=90:
        a=a+0.03
        turtle.lt(3)
        turtle.fd(a)
    else:
        a=a-0.03
        turtle.lt(3)
        turtle.fd(a) 
turtle.penup()
turtle.end_fill()
turtle.goto(120,-160)
turtle.pendown()
turtle.seth(210)
turtle.begin_fill()
a=0.5
for i in range(120):
    if 0<=i<30 or 60<=i<=90:
        a=a+0.03
        turtle.lt(3)
        turtle.fd(a)
    else:
        a=a-0.03
        turtle.lt(3)
        turtle.fd(a)
turtle.end_fill()
turtle.penup()
turtle.goto(0,-200)
turtle.seth(0)
turtle.pendown()

turtle.begin_fill()
turtle.fd(10)
turtle.seth(-105)
turtle.fd(30)
turtle.seth(105)
turtle.fd(30)
turtle.seth(0)
turtle.fd(10)
turtle.end_fill()
turtle.hideturtle()
turtle.mainloop()

 

python画的小乌龟

标签:end   loop   imp   bsp   for   nbsp   down   set   span   

原文地址:https://www.cnblogs.com/xiaoerduo00/p/9940942.html

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