用Python绘制沙雕表情包

今天带大家绘制一个沙雕小人
用海龟库实现
整体还是比较简单的
就是定位麻烦一点
代码如下:

import turtle as t

t.speed(2)
t.pensize(2)
# 脸
t.circle(200, 30)
t.circle(100, 60)
t.circle(200, 40)
# print(t.pos())
t.pu()
t.goto(75, 265)
t.pd()
t.seth(150)
t.circle(170, 55)

t.pu()
t.goto(0, 0)
t.pd()
t.seth(0)
t.circle(200, -30)
t.circle(100, -60)
t.circle(200, -40)
# print(t.pos())

# 耳朵
t.seth(115)
t.circle(-200, 15)
# print(t.pos())
t.right(130)
t.circle(200, 15)

t.pu()
t.goto(103, 241)
t.pd()

t.seth(90)
t.circle(-200, 15)
# print(t.pos())
t.right(-130)
t.circle(200, 15)

t.pu()
t.goto(-110,280)
t.pd()
t.seth(115+180)
t.circle(200, 10)

t.pu()
t.goto(100,280)
t.pd()
t.seth(-130)
t.circle(200, 10)

# 领子
t.pu()
t.goto(0, 0)
t.pd()
t.goto(-20, -20)
t.goto(-60, 11)
t.pu()
t.goto(0, 0)
t.pd()
t.goto(20, -20)
t.goto(60, 11)

# 身子
t.pu()
t.goto(80, 16)
t.pd()
t.seth(180-50)
t.circle(200, -40)
t.pu()
t.goto(-80, 16)
t.pd()
t.seth(180+50)
t.circle(200, 40)

# 五官
t.pu()
t.goto(-80, 150)
t.pd()
t.write('你最', font=('楷体', 60))
t.pu()
t.goto(-80, 75)
t.pd()
t.write('漂亮', font=('楷体', 60))


t.done()

效果图:
在这里插入图片描述
一起学习python,小白指导,教学分享记得私信我

猜你喜欢

转载自blog.csdn.net/Miku_wx/article/details/112098959