【python turtle 画 史努比】

本文详细描述了使用Python的turtle库绘制卡通角色Snoopy的像素画过程,涉及颜色设置、图形绘制和填充等技术。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#绘画Snoopy
import turtle as t
t.colormode(255)
t.bgcolor(255,160,122)
t.speed(6)
t.pensize(3)
t.fillcolor("white")
t.begin_fill()
t.penup()
t.goto(10,160)
t.setheading(150)
t.pendown()
t.circle(100,80)
t.circle(80,30)
t.circle(60,30)
x1,y1=t.pos()
t.circle(40,50)
t.fd(130)
t.circle(-30,90)
t.fd(30)
t.setheading(-120) #肚子
t.fd(20)
t.setheading(-130)
t.circle(50,130)
t.fd(20)
t.circle(-10,30) #脚踝
t.setheading(-90)
t.fd(15)
t.circle(-20,90) #前脚
t.fd(20)
t.circle(200,10)
t.circle(30,80)
t.circle(15,80)
t.setheading(-0)
t.circle(-10,50)  #脚底
t.circle(10,50)
t.fd(130)
t.circle(10,100)
t.fd(25)#后脚
t.circle(10,110)
t.circle(-10,120)
t.fd(40)
t.setheading(60)
t.circle(150,20)  #后背
t.circle(5,90)
t.circle(-10,90)
t.left(30)
t.fd(70)
t.circle(-30,100)
t.setheading(-80)
t.circle(40,60)  #外耳廓
t.circle(60,20)
t.circle(20,60)
t.circle(150,40)
t.circle(20,30)
t.fd(10)
t.setheading(100)
t.circle(150,30)
t.circle(80,60)
t.circle(60,70)
t.goto(10,160)
t.end_fill()#出现了黑色无关线条

#五官
#鼻子
t.fillcolor("black")
t.begin_fill()
t.penup()
t.goto(-135,90)
t.pendown()
t.circle(-15,130)
t.right(30)
t.circle(-10,160)
t.goto(-135,90)
t.end_fill()#出现了黑色无关线条
t.right(40)
t.circle(-15,360)

#嘴
t.pensize(5)
t.penup()
t.goto(-4,4)
t.pendown()
t.setheading(-5)
t.circle(80,70)

#眼睛
t.penup()
t.goto(41,136)
t.pendown()
t.left(180)
t.pensize(5)
t.fd(20)

#眉毛
t.penup()
t.goto(60,176)
t.pendown()
t.right(100)
t.pensize(5)
t.fd(30)

#耳朵
t.pensize(3)
t.penup()
t.goto(114,11)
t.pendown()
t.setheading(110)
t.circle(-60,70)
#内
t.fillcolor("black")
t.begin_fill()
t.penup()
t.goto(130,12)
t.pendown()
t.setheading(-80)
t.circle(30,60)#耳朵
t.circle(30,20)
t.circle(20,60)
t.circle(70,40)
t.fd(10)
t.circle(10,150)
t.circle(-5,150)
t.fd(20)
t.setheading(-140)
t.circle(60,70)
t.goto(130,12)
t.end_fill()#出现了黑色无关线条
t.fillcolor("white")
t.begin_fill()
t.penup()
t.goto(145,22)
t.pendown()
t.circle(10,100)
t.circle(8,70)
t.circle(6,170)
t.goto(145,22)
t.end_fill()

#手
t.pensize(3)
t.penup()
t.goto(126,-119)
t.pendown()
t.setheading(-100)
t.fd(10)
t.circle(-4,170)
t.fd(10)
t.circle(3,170)
t.fd(14)
t.circle(-6,190)
t.fd(16)
t.circle(5,190)
t.fd(26)
t.circle(-7,190)
t.fd(40)
t.circle(5,40)
t.fd(40)

#下半身
#链子
t.fillcolor("red")
t.begin_fill()
t.penup()
t.goto(30,-13)
t.pendown()
t.pensize(5)
t.setheading(-180)
t.circle(15,180)
t.fd(10)
t.pensize(3)
t.setheading(-10)
t.fd(60)
t.circle(13,180)
t.fd(60)
t.pensize(5)
t.setheading(170)
t.goto(30,-13)
t.end_fill()#出现了黑色无关线条
t.left(180)
t.fd(10)
t.circle(-7.5,180)
t.fd(5)
t.left(180)
t.fd(5)
t.circle(-7.5,180)
t.fd(10)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值