新手小白上路啦~
# 人手一个熊猫🐼宝宝~~~~~~
import turtle as t
t.title("熊猫宝宝")
t.shape("classic")
t.pensize(3)
t.color("black")
t.fillcolor("black")
t.speed(100)
t.hideturtle()
# 左耳
t.penup()
t.goto(-105, 97)
t.setheading(160)
t.begin_fill()
t.pendown()
t.circle(-30, 230)
t.setheading(180)
t.circle(37, 90)
t.end_fill()
# 右耳
t.penup()
t.goto(105, 97)
t.setheading(20)
t.begin_fill()
t.pendown()
t.circle(30, 230)
t.setheading(0)
t.circle(-37, 90)
t.end_fill()
# 头部轮廓
t.penup()
t.goto(-67, 140)
t.setheading(30)
t.pendown()
t.circle(-134, 60)
t.penup()
t.goto(-50, -25)
t.setheading(180)
t.pendown()
t.circle(-100, 30)
t.circle(-30, 90)
t.setheading(100)
t.circle(-200, 20)
t.penup()
t.goto(50, -25)
t.setheading(0)
t.pendown()
t.circle(100, 30)
t.circle(30, 90)
t.setheading(80)
t.circle(200, 20)
# 两熊猫眼
# 左眼
t.penup()
t.goto(-90, 25)
t.setheading(-45)
t.begin_fill()
t.pendown()
# 椭圆绘制技巧
a = 0.2
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.1
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
else:
a = a - 0.1
t.lt(3)
t.fd(a)
t.end_fill()
t.fillcolor("white")
t.penup()
t.goto(-53, 43)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(13, 360)
t.end_fill()
t.penup()
t.pensize(4)
t.goto(-60, 57)
t.setheading(30)
t.pendown()
t.circle(-12, 60)
# 右眼
t.penup()
t.goto(90, 25)
t.setheading(45)
t.pensize(2)
t.fillcolor("black")
t.begin_fill()
t.pendown()
# 椭圆绘制技巧
a = 0.2
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.1
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
else:
a = a - 0.1
t.lt(3)
t.fd(a)
t.end_fill()
t.fillcolor("white")
t.penup()
t.goto(53, 43)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(13, 360)
t.end_fill()
t.penup()
t.pensize(4)
t.goto(60, 57)
t.setheading(150)
t.pendown()
t.circle(12, 60)
# 鼻子和嘴吧
t.penup()
t.goto(-16, 20)
t.setheading(-90)
t.fillcolor("black")
t.begin_fill()
t.pendown()
a = 0.2
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.03
t.lt(3)
t.fd(a)
else:
a = a - 0.03
t.lt(3)
t.fd(a)
t.end_fill()
t.penup()
t.goto(-24, 0)
t.setheading(-60)
t.pendown()
t.circle(28, 120)
# 熊肢体
# 左肢
t.penup()
t.goto(-65, -24)
t.setheading(-140)
t.begin_fill()
t.pendown()
t.circle(100, 40)
t.setheading(180)
t.circle(30, 40)
t.setheading(-40)
t.circle(40, 40)
t.setheading(-150)
a = 0.5
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.05
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
elif 30 <= i < 60 or 90 <= i < 100:
a = a - 0.05
t.lt(3)
t.fd(a)
t.setheading(93)
t.circle(-150, 30)
t.end_fill()
t.penup()
t.goto(-85, -115)
t.setheading(-150)
t.color("gray", "gray")
t.begin_fill()
t.pendown()
a = 0.3
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.03
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
else:
a = a - 0.03
t.lt(3)
t.fd(a)
t.end_fill()
# 每个脚趾绘制函数
def toe(x, y):
t.begin_fill()
t.goto(x, y)
t.circle(3, 360)
t.end_fill()
t.penup()
toe(-98, -120)
toe(-96, -110)
toe(-88, -105)
toe(-80, -105)
# 右肢
t.color("black")
t.penup()
t.goto(65, -24)
t.setheading(-40)
t.begin_fill()
t.pendown()
t.circle(-100, 40)
t.setheading(0)
t.circle(-30, 40)
t.setheading(-140)
t.circle(-40, 40)
t.setheading(-30)
a = 0.5
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.05
t.rt(3) # 向左转3度
t.fd(a) # 向前走a的步长
elif 30 <= i < 60 or 90 <= i < 100:
a = a - 0.05
t.rt(3)
t.fd(a)
t.setheading(87)
t.circle(150, 30)
t.end_fill()
t.penup()
t.goto(85, -115)
t.setheading(150)
t.color("gray", "gray")
t.begin_fill()
t.pendown()
a = 0.3
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.03
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
else:
a = a - 0.03
t.lt(3)
t.fd(a)
t.end_fill()
t.penup()
toe(98, -120)
toe(96, -110)
toe(88, -105)
toe(80, -105)
t.goto(-57, -140)
t.color("black")
t.setheading(-20)
t.pendown()
t.circle(165, 40)
t.penup()
t.goto(0, 180)
t.write("April071 baby is the most lovely girl", align="center"
, font=("Times", 18, "bold"))
t.done()
本文来自博客园,作者:April071,转载请注明原文链接:https://www.cnblogs.com/April071/p/15932163.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?