python绘图 ——蜡笔小新

源代码如下:

import turtle as t 
t.setup(600,600)
t.screensize(100,100,"#b9a281")
t.speed(10)
t.pensize(2)
#头
t.pu()
t.goto(-200,-100)
t.pd()
t.color('black', '#fea993')
t.begin_fill()
t.seth(-30)
t.circle(300,80)
t.circle(110,110)
t.circle(50,20)
t.fd(30)
t.rt(60)
t.circle(170,130)
t.rt(10)
t.circle(250,23)

#耳朵
t.pu()
t.goto(-210,0)
t.seth(115)
t.pd()
t.circle(40,140)
t.circle(200,17)
t.circle(51,120)
t.fd(15)
t.end_fill()
#头发
t.pu()
t.fillcolor(0,0,0)
t.goto(-260,20)
t.begin_fill()
t.pd()
t.rt(11)
t.circle(-40,95)
t.seth(90)
t.fd(72)
t.rt(5)
t.fd(60)
t.circle(-20,50)
t.circle(-500,23)
t.fd(3)
t.seth(162)
t.circle(170,75)
t.lt(0)
t.circle(400,20)
t.end_fill()
#眼睛
t.pu()
t.goto(-170,75)
t.pd()
t.seth(33)
t.circle(-400,16)
t.pu()
t.lt(7)
t.fd(30)
t.pd()
t.fd(25)
t.rt(20)
t.circle(-400,10)
#眉毛
t.pu()
t.goto(-167,135)
t.pd()
t.pensize(30)
t.seth(65)
t.fd(40)
t.circle(-25,105)
t.fd(25)
t.pu()
t.goto(-45,185)
t.pd()
t.pensize(30)
t.seth(55)
t.fd(30)
t.circle(-25,105)
t.fd(25)
#羞羞
t.pensize(3)
t.pu()
t.goto(-155,60)
t.pencolor("#fa2a55")
t.pd()
t.seth(-110)
t.fd(25)
t.pu()
t.goto(-145,63)
t.pd()
t.seth(-110)
t.fd(25)
t.pu()
t.goto(70,125)
t.pd()
t.seth(-110)
t.fd(20)
t.pu()
t.goto(80,120)
t.pd()
t.seth(-110)
t.fd(18)
t.pensize(2)
t.pencolor(0,0,0)
#嘴巴
t.pu()
t.goto(-115,-65)
t.pd()
t.seth(-70)
t.pd()
t.color('black', '#a24857')
t.begin_fill()
a =9
for i in range(36):
    if 0 <= i < 9 or 18 <= i <27:
        a = a+2.5
        t.lt(10)
        t.fd(a) 
    else:
        a = a-2.5
        t.lt(10)
        t.fd(a)
t.end_fill()
#包子
t.fillcolor("#ffd8b1")
t.pu()
t.goto(20,-110)
t.pd()
t.begin_fill()
t.seth(-10)
t.circle(500,25)
t.circle(20,30)
t.fd(10)
t.circle(20,10)
t.fd(10)
t.circle(70,50)
t.circle(30,2)
t.circle(70,60)
t.rt(30)
t.circle(40,70)
t.rt(60)
t.circle(50,70)
t.rt(70)
t.circle(40,70)
t.rt(20)
t.circle(70,40)
t.rt(10)
t.circle(100,60)
t.circle(25,50)
t.end_fill()
t.pu()
t.goto(80,25)
t.pd()
t.seth(-140)
t.circle(50,60)
t.pu()
t.goto(120,27)
t.pd()
t.seth(-130)
t.circle(50,55)
t.pu()
t.goto(150,22)
t.pd()
t.seth(-80)
t.circle(50,50)
t.pu()
t.goto(190,27)
t.pd()
t.fd(15)
t.hideturtle()
t.mainloop()

运行结果如下:
由于时间有限,画的并不太完整

这个程序可能略显简陋,这是我第一个python程序,刚刚起步学,也算是留个纪念吧!希望自己随着自己学习的不断深入,会带来更多有意思,有价值的程序!

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐