如何用Python快速画一只可爱的佩奇
代码搬运工:
Monster12138/Peppa-Pig: 使用python turtle库画一只小猪佩奇 https://github.com/Monster12138/Peppa-Pig
先上图哈
@可可爱爱@

代码搞起来:
# coding:utf-8
from turtle import*
def nose(x,y):#鼻子
pu()
goto(x,y)
pd()
seth(-30)
begin_fill()
a=0.4
for i in range(120):
if 0<=i<30 or 60<=i<90:
a=a+0.08
lt(3) #向左转3度
fd(a) #向前走a的步长
else:
a=a-0.08
lt(3)
fd(a)
end_fill()
pu()
seth(90)
fd(25)
seth(0)
fd(10)
pd()
pencolor(255,155,192)
seth(10)
begin_fill()
circle(5)
color(160,82,45)
end_fill()
pu()
seth(0)
fd(20)
pd()
pencolor(255,155,192)
seth(10)
begin_fill()
circle(5)

本文介绍了使用Python的turtle库来快速画出可爱的小猪佩奇,提供了GitHub资源链接及示例图片,还推荐了一首背景音乐。
最低0.47元/天 解锁文章
711

被折叠的 条评论
为什么被折叠?



