前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Python Turtle Graphics实现绘画蜡笔小新吃包子

Python Turtle Graphics实现绘画蜡笔小新吃包子

原创
作者头像
菜菜有点菜
发布2024-05-04 16:28:23
1390
发布2024-05-04 16:28:23

直接上代码:

代码语言: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()

效果:

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档


http://www.vxiaotou.com