今天看了嵩天老师讲解了python蟒蛇绘制的教程,所以自己就想尝试用turtle画《日常》里的坂本猫,共花费了3个小时,一百多行代码,全是最基础的turtle.函数,应该存在不少冗余。但不管怎样总算是完成了,在此记录。
import turtle as t
#设置画布及画笔
t.colormode(255)
t.bgcolor(231,224,214)
t.pensize(2.5)
t.pencolor(84,84,84)
t.penup()
t.goto(0,-90)
t.pendown()
#画左脸
t.fillcolor(84,84,84)
t.begin_fill()
t.seth(-180)
t.circle(-400,30)
t.goto(-90,300)
t.left(160)
t.circle(-600,13)
#画右脸
t.penup()
t.goto(0,-90)
t.seth(0)
t.pendown()
t.circle(400,30)
t.goto(90,300)
t.right(160)
t.circle(600,13)
t.seth(180)
t.fd(30)
t.penup()
t.goto(0,-90)
t.pendown()
#填充脸颜色
t.end_fill()
#左眼
t.pencolor(57,45,36)
t.penup()
t.home()
t.goto(-90,15)
t.pendown()
t.fillcolor(255,255,255)
t.begin_fill()
t.seth(60)
t.circle(400,10)
t.seth(120)
t.circle(400,10)
t.left(120)
t.circle(400,10)
t.left(30)
t.circle(400,10)
t.end_fill()
#左眼瞳仁
t.penup()
t.goto(-92,45)
t.seth(90)
t.pensize(10)
t.pencolor(39,32,32)
t.pendown()
t.goto(-92,95)
#右眼
t.pensize(2.5)
t.pencolor(57,45,36)
t.penup()
t.home()
t.goto(90,15)
t.pendown()
t.fillcolor(255,255,255)
t.begin_fill()
t.seth(60)
t.circle(400,10)
t.seth(120)
t.circle(400,10)
t.left(120)
t.circle(400,10)
t.left(30)
t.circle(400,10)
t.end_fill()
#右眼瞳仁
t.penup()
t.goto(92,45)
t.seth(90)
t.pensize(10)
t.pencolor(39,32,32)
t.pendown()
t.goto(92,95)
#身子
t.pencolor(84,84,84)
t.penup()
t.goto(-130,-60)
t.right(200)
t.pendown()
t.fillcolor(84,84,84)
t.begin_fill()
t.circle(900,21.6)
t.seth(0)
t.fd(330)
t.left(80)
t.circle(900,21.6)
t.end_fill()
#围巾1
t.pencolor(238,99,94)
t.penup()
t.goto(-140,-70)
t.seth(-15)
t.pendown()
t.fillcolor(238,99,94)
t.begin_fill()
t.circle(500,33)
t.right(150)
t.circle(-600,20)
t.right(65)
t.circle(-600,17)
t.end_fill()
t.pencolor(163,68,62)
t.fillcolor(163,68,62)
t.begin_fill()
t.penup()
t.goto(-140,-70)
t.pendown()
t.seth(-5)
t.circle(-600,17)
t.end_fill()
#围巾2
t.penup()
t.pencolor(238,99,94)
t.pensize(5)
t.goto(-193,1)
t.pendown()
t.seth(-200)
t.begin_fill()
t.fillcolor(238,99,94)
t.circle(-200,40)
t.right(100)
t.circle(-200,40)
t.goto(-193,1)
t.end_fill()
#围巾3
t.penup()
t.goto(193,1)
t.pendown()
t.seth(30)
t.begin_fill()
t.circle(200,50)
t.right(270)
t.circle(200,40)
t.goto(193,1)
t.end_fill()
t.penup()
t.goto(190,40)
t.pendown()
t.seth(30)
t.pencolor(163,68,62)
t.begin_fill()
t.fillcolor(163,68,62)
t.goto(250,100)
t.goto(190,40)
t.end_fill()
t.done()
↑真正的坂本先生
↑我画的坂本先生(XD眼睛小了一倍!)