python 画蜡笔小新

本文详细介绍了如何利用Python的Turtle库,通过一系列绘图指令,创造出一个卡通角色的头部和身体部分,展示了基础图形操作和颜色设置技巧。
摘要由CSDN通过智能技术生成
import turtle as t
'''设置'''
t.setup(800,500) # 创建画布并使其位于屏幕中心
t.pensize(2)  #  画笔粗细
t.colormode(255)  # 色彩模式
t.speed(5)  # 绘画速度
t.color('black',(255,228,181))  # 画笔颜色与填充色
t.shape('turtle')  # 画笔的形状
t.speed(5)  #画笔速度
t.showturtle() # 使画笔显现
# 头
t.pu()
t.goto(-150,10)
t.pd()
t.seth(0)
t.begin_fill()
t.left(135)
t.circle(-70,85)
t.right(8)
t.circle(-85,44)
t.left(10)
t.circle(40,61)
t.right(15)
t.fd(20)
t.right(5)
t.circle(-40,45)
t.left(6)
t.circle(-70,25)
t.left(18)
t.circle(-80,35)
t.left(10)
t.circle(-70,27)
t.circle(-120,54)

# 耳朵
t.pu()
t.goto(82,30)
t.pd()
t.left(140)
t.fd(20)
t.right(10)
t.circle(-20,65)
t.seth(-50)
t.fd(5)
t.right(13)
t.circle(-50,50)
t.right(10)
t.circle(-60,25)
t.right(7)
t.circle(-50,20)
t.circle(-10,90)

# 补充完整头部
t.pu()
t.goto(-150,10)
t.pd()
t.color('black',(255,228,181))
t.right(130)
t.circle(90,33)
t.right(16)
t.circle(370,28)
t.end_fill()

# 头发
t.color('black','black')
t.pu()
t.goto(-18,180)
t.pd()
t.begin_fill()
t.right(30)
t.circle(-350,19)
t.right(38)
t.circle(-300,17)
t.left(135)
t.fd(23)
t.left(39)
t.circle(120,63)
t.left(10)
t.circle(110,28)
t.right(11)
t.circle(85,14)
t.end_fill()

#眉毛
t.pu()
t.goto(-52,151)
t.pd()
t.begin_fill()
t.right(205)
t.circle(110,33)
t.circle(7,130)
t.left(50)
t.circle(-110,30)
t.circle(8,140)
t.end_fill()
t.pu()
t.goto(48,140)
t.pd()
t.begin_fill()
t.right(4)
t.circle(150,18)
t.right(4)
t.circle(-6,140)
t.right(28)
t.circle(-150,19)
t.right(10)
t.circle(-10,150)
t.end_fill()
t.pu()
t.goto(-69,126)
t.pd()
t.left(70)
t.circle(-80,37)
t.right(15)
t.circle(-25,100)
t.pu()
t.goto(2,91)
t.pd()
t.left(150)
t.circle(-70,30)
t.right(10)
t.circle(-40,60)
t.circle(-70,20)

#眼睛
t.pu()
t.goto(-60,110)
t.pd()
t.begin_fill()
t.right(52)
t.circle(27)
t.end_fill()
t.color('black','white')
t.pu()
t.goto(-45,110)
t.pd()
t.begin_fill()
t.right(24)
t.circle(20,80)
t.circle(7,100)
t.seth(40)
t.fd(22)
t.left(17)
t.circle(10,155)
t.end_fill()
t.pu()
t.goto(-20,95)
t.pd()
t.begin_fill()
t.left(70)
t.circle(-14,80)
t.circle(-7,120)
t.right(44)
t.circle(35,30)
t.end_fill()
t.pu()
t.goto(-41,77)
t.pd()
t.begin_fill()
t.left(28)
t.circle(6)
t.end_fill()
t.color('black','black')
t.pu()
t.goto(-5,55)
t.pd()
t.begin_fill()
t.left(10)
t.circle(-25)
t.end_fill()
t.color('black','white')
t.pu()
t.goto(5,57)
t.pd()
t.begin_fill()
t.left(40)
t.circle(-8,120)
t.left(30)
t.circle(-19,80)
t.circle(-8,120)
t.right(32)
t.circle(19,60)
t.right(55)
t.circle(-9,95)
t.end_fill()
t.pu()
t.goto(38,62)
t.pd()
t.begin_fill()
t.left(190)
t.circle(-15,50)
t.circle(-8,100)
t.right(40)
t.circle(-10,80)
t.end_fill()
t.pu()
t.goto(10,50)
t.pd()
t.begin_fill()
t.circle(-5)
t.end_fill()

#嘴巴
t.pu()
t.goto(-129,12)
t.pd()
t.circle(-40,35)
#身体
t.color('black',(205,32,32))
t.pu()
t.goto(-142,7)
t.pd()
t.begin_fill()
t.seth(-150)
t.fd(18)
t.seth(150)
t.fd(55)
t.left(105)
t.circle(-43,40)
t.right(125)
t.circle(-43,30)
t.left(180)
t.circle(43,30)
t.seth(-50)
t.fd(46)
t.circle(50,26)
t.left(27)
t.circle(60,50)
t.right(180)
t.circle(100,60)
t.seth(0)
t.fd(194)
t.left(120)
t.circle(-50,50)
t.fd(25)
t.right(20)
t.circle(34,66)
t.circle(18,116)
t.right(30)
t.circle(-90,18)
t.seth(135)
t.fd(12)
t.seth(-145)
t.fd(10)
t.right(46)
t.circle(-90,20)
t.circle(10,100)
t.circle(-60,20)
t.right(130)
t.circle(-50,20)
t.left(90)
t.circle(-370,6)
t.left(15)
t.circle(-90,13)
t.right(7)
t.circle(-90,18)
t.end_fill()
t.pu()
t.goto(-64,-33)
t.pd()
t.left(160)
t.circle(100,40)
t.circle(40,40)

#手
t.color('black',(255,228,181))
t.pu()
t.goto(-62,-28)
t.pd()
t.begin_fill()
t.seth(140)
t.fd(8)
t.left(77)
t.circle(-12,150)
t.left(90)
t.fd(11)
t.circle(-4,120)
t.right(45)
t.fd(11)
t.left(130)
t.circle(20,35)
t.circle(-4,140)
t.right(30)
t.circle(-20,40)
t.left(160)
t.circle(20,40)
t.circle(-4,140)
t.right(20)
t.circle(-20,50)
t.left(190)
t.circle(-20,40)
t.circle(-3,130)
t.left(5)
t.circle(-20,60)
t.left(180)
t.circle(-20,40)
t.seth(25)
t.fd(10)
t.left(240)
t.circle(-30,30)
t.left(40)
t.circle(60,20)
t.seth(-30)
t.fd(7)
t.seth(-125)
t.fd(25)
t.end_fill()
t.pu()
t.goto(-212,3)
t.pd()
t.begin_fill()
t.seth(150)
t.fd(12)
t.left(90)
t.fd(8)
t.right(50)
t.circle(-9,90)
t.left(110)
t.fd(14)
t.right(40)
t.circle(-4,120)
t.right(15)
t.circle(-20,40)
t.left(180)
t.circle(-3,100)
t.left(123)
t.circle(-30,30)
t.circle(-3,150)
t.right(10)
t.circle(-30,30)
t.seth(80)
t.fd(3)
t.left(72)
t.circle(30,30)
t.right(8)
t.circle(-4,120)
t.right(43)
t.circle(-30,40)
t.seth(80)
t.fd(3)
t.left(70)
t.circle(30,34)
t.right(17)
t.circle(-4,120)
t.right(27)
t.circle(-20,90)
t.left(180)
t.circle(-20,50)
t.seth(35)
t.fd(8)
t.left(234)
t.circle(60,20)
t.seth(-33)
t.circle(-50,23)
t.seth(-119)
t.fd(16)
t.end_fill()
t.done()

运行结果

  • 7
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

暴躁的秋秋

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值