天天看点

用python的turtle画皮卡丘_Python选修课第二届Turtle绘图大赛 (皮卡丘)

(a)

20181004116 徐虎

20181004113 何磊

(b)

import turtle as t

def y(a,b):

t.pu()

t.goto(a,b)

t.pd()

def y1(a,b):

t.pu()

t.goto(t.xcor()+a,t.ycor()+b)

t.pd()

t.setup(width=1920,height=1080)

t.speed(70)

t.pensize(3)

#身体轮廓

y(-200,180)

t.seth(85)

t.circle(-150,50)

t.seth(25)

t.circle(-280,50)

t.seth(40)

t.circle(-390,30)

t.begin_fill()

t.circle(-390,22)

t.seth(227)

t.circle(-420, 15)

t.seth(105)

t.circle(150, 32)

t.end_fill()

y(347.23,302.78)

t.seth(212)

t.circle(-420, 28)

y1(5,-2)

t.seth(280)

t.circle(800, 30)

t.circle(-270, 11)

t.circle(-270, 44)

y(358.29,-177.98)

#尾巴

y1(5,-2)

t.begin_fill()

t.seth(50)

t.fd(40)

t.seth(-50)

t.fd(48)

t.seth(-140)

t.fd(52)

t.end_fill()

t.seth(39)

t.fd(108)

t.seth(125)

t.fd(72)

t.seth(40)

t.fd(79.5)

t.seth(88)

t.fd(67.5)

t.seth(35)

t.fd(157.5)

t.seth(105)

t.circle(1275, 8)

t.seth(215)

t.circle(1275, 11)

t.seth(280)

t.fd(165)

t.seth(220)

t.fd(78)

t.seth(309)

t.fd(84)

#底

y(382.94,-378.76)

y1(5,-2)

t.seth(20)

t.circle(180, -45)

t.seth(330)

t.circle(-225, -30)

t.seth(230)

t.circle(-105, 120)

#两脚

y(382.94,-378.76)

t.seth(-86)

t.fd(45)

t.seth(-93)

t.fd(46.6)

t.seth(-225)

t.circle(-180, 30)

y(-46.30,-311.03)

t.seth(-105)

y1(127.5,-64.5)

t.fd(75)

t.seth(-225)

t.circle(-180, 30)

y(-41.30,-313.03)

t.seth(90)

t.circle(675, 13)

t.circle(675, 5)

t.pu()

t.circle(675, 5)

t.pd()

t.left(8)

t.circle(675, 10)

t.seth(322)

t.circle(115, -78)

t.seth(30)

t.circle(-32, 120)

t.seth(-70)

t.circle(-40, 140)

#左手

y(-58.60,-161.19)

t.seth(160)

t.circle(225, 30)

t.seth(180)

t.circle(-45, 150)

t.fd(99)

y1(-60,-90)

t.seth(200)

t.circle(-7.5, 180)

#右手

y(-58.60,-161.19)

y1(270,7.5)

t.seth(200)

t.circle(-75, 90)

t.pu()

t.circle(-75, 14)

t.pd()

t.circle(-75, 65)

y(180,-100)

t.seth(80)

t.fd(15)

t.seth(165)

t.circle(15, 60)

t.seth(90)

t.fd(7.5)

t.seth(165)

t.circle(15, 60)

t.seth(95)

t.fd(7.5)

t.seth(185)

t.circle(15, 60)

t.seth(105)

t.fd(15)

t.seth(230)

t.fd(30)

t.seth(145)

t.fd(15)

t.seth(285)

t.fd(30)

#脸颊

y1(-60,205)

t.circle(40.5, 360)

#嘴巴

y1(-65,42)

t.seth(280)

t.circle(-195, 30)

t.seth(270)

t.circle(-9, 160)

t.seth(130)

t.circle(-195, 30)

y1(-7.5,7.5)

t.seth(160)

t.circle(-30, -70)

t.seth(160)

t.circle(-45, -60)

y1(0,-42)

t.seth(200)

t.circle(71, 58)

#左眼

y1(-65,185)

t.begin_fill()

t.seth(190)

t.circle(30, 130)

t.seth(310)

t.circle(15, 15)

t.seth(0)

t.circle(33, 133)

t.seth(90)

t.circle(20, 15)

t.end_fill()

y1(3,-22.5)

t.color("white")

t.begin_fill()

t.circle(10.5)

t.end_fill()

#右眼

y1(135,37.5)

t.color("black")

t.begin_fill()

t.seth(190)

t.circle(30, 130)

t.seth(310)

t.circle(15, 15)

t.seth(0)

t.circle(33, 133)

t.seth(90)

t.circle(20, 15)

t.end_fill()

y1(-10.5,-22.5)

t.color("white")

t.begin_fill()

t.circle(10.5)

t.end_fill()

#左耳

t.color("black")

y(-200,180)

y1(22.5,62)

t.seth(90)

t.circle(-375,30)

t.begin_fill()

t.circle(-375,18)

t.seth(270)

t.circle(-405, 12)

t.seth(180)

t.circle(150, 30)

t.end_fill()

y(-62.27,431.48)

t.seth(270)

t.circle(-400, 18)