Python选修课第二届Turtle绘图大赛~~画猫猫

时间:2021-09-29 07:35:45

(a)20161401167 夏思敏

         20161401179 段梦格

(b)代码执行视频链接

          点击查看:Python使用turtle库画猫猫

(c)程序源码

import turtle
turtle.setup(800,800)
turtle.pensize(3) 
turtle.speed(0)
def maomao(m,n,r,R):
    turtle.pencolor(R) 
    turtle.penup()
    turtle.goto(m,n)
    turtle.pendown()
    turtle.circle(r,-180)
    turtle.right(120)
    turtle.forward(2/3*r)
    turtle.right(120)
    turtle.fd(2/3*r)
    turtle.left(60)
    turtle.fd(2/3*r)
    turtle.left(60)
    turtle.fd(2/3*r)
    turtle.right(120)
    turtle.fd(2/3*r)
    turtle.left(60)
    turtle.circle(-r,180)
    turtle.penup()
    turtle.goto(m+2*r,n+3/2*r)
    turtle.pendown()
    turtle.fd(2/3*r)
    turtle.penup()
    turtle.goto(m,n+3/2*r)
    turtle.pendown()
    turtle.backward(2/3*r)
    turtle.left(90)
    turtle.fillcolor(R)
    turtle.begin_fill()
    turtle.circle(-1/3*r,180)
    turtle.end_fill()
    turtle.penup()
    turtle.goto(m+2/3*r,n+r)
    turtle.pendown()
    turtle.circle(-4/15*r,-180)
    turtle.circle(4/15*r,180)
    turtle.penup()
    turtle.goto(m,n)
    turtle.right(90)
    turtle.pendown()
    turtle.fd(2*r)
    turtle.penup()
    turtle.home()
    turtle.pendown()
maomao(-40,270,30,'red')
maomao(-100,180,30,'orange')
maomao(20,180,30,'orange')
maomao(-160,90,30,'yellow')
maomao(-40,90,30,'yellow')
maomao(80,90,30,'yellow')
maomao(-210,0,30,'green')
maomao(-90,0,30,'green')
maomao(30,0,30,'green')
maomao(150,0,30,'green')
maomao(-270,-90,30,'cyan')
maomao(-150,-90,30,'cyan')
maomao(-30,-90,30,'cyan')
maomao(90,-90,30,'cyan')
maomao(210,-90,30,'cyan')
maomao(-30,-180,30,'blue')
maomao(-30,-270,30,'blue')
maomao(-30,-360,30,'blue')
turtle.penup()
turtle.goto(-300,200)
turtle.left(60)
turtle.pendown()
turtle.pencolor('purple') 
turtle.write('喵喵喵~~~',font=("Times", 18, "bold"))
turtle.hideturtle()
turtle.exitonclick()