如何用Python画一只狗狗——turtle基础

                         

这只小狗主要用了turtle库里的circle()头有些方正,比较自然。

话不多说,展示代码:

from turtle import *
pensize(5)
seth(0)
pd()
color('black')
circle(20, 80) 
circle(200, 30)  
circle(30, 60)  
circle(200, 29.5) 
circle(20, 60) 
circle(-150, 22) 
circle(-50, 10)  
circle(50, 70)  
x_nose = xcor()
y_nose = ycor()
circle(30, 62)  
circle(200, 15)  
pu()
goto(x_nose, y_nose+25)
pd()
begin_fill()
circle(8)
end_fill()
pu()
goto(x_nose+48, y_nose+55)
pd()
begin_fill()
circle(8)
end_fill()
pu()
goto(x_nose+100, y_nose+110)
seth(182)
pd()
circle(15, 45) 
circle(10, 15) 
circle(90, 70) 
circle(25, 110) 
circle(90, 70) 
circle(10, 15) 
circle(15, 45)  
pu()
goto(x_nose+90, y_nose-30)
seth(-130)
pd()
circle(250, 28)  
circle(10, 140)  
circle(-250, 25)  
circle(-200, 25)  
circle(-50, 85)  
circle(8, 145)  
circle(90, 45)  
circle(550, 5)  
seth(0)
circle(60, 85)
circle(40, 65)  
circle(40, 60) 
lt(150)
circle(-40, 90)  
circle(-25, 100)  
lt(5)
fd(20)
circle(10, 60)  
rt(80)
circle(200, 35)
pensize(20)
color('#F03C3F')
lt(10)
circle(-200, 25)  
pu()
fd(18)
lt(90)
fd(18)
pensize(6)
seth(35)
color('#FDAF17')
begin_fill()
lt(135)
fd(6)
right(180) 
circle(6, -180)
backward(8)
right(90)
forward(6)
circle(-6, 180)
fd(15)
end_fill()
pensize(5)
pu()
color('black')
goto(x_nose+100, y_nose-125)
pd()
seth(-50)
fd(25)
circle(10, 150)
fd(25)
pu()
goto(x_nose+314, y_nose-125)
pd()
seth(-95)
fd(25)
circle(-5, 150)

  • 10
    点赞
  • 51
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值