Python画一个哆啦A梦代码

import turtle as t

t.speed(0) #设置绘制速速

t2=t.Turtle()

def funa(x,y):

t.pu()

t.goto(x,y)

t.dot(10,'red')

t2.clear()

t2.write('{},{}'.format(x,y),align='center',font=('黑体',20,'bold'))

def huxian(x,y,r,a):

t.pu()

t.goto(x,y)

t.pd()

t.circle(r,a)

def line2(x1,y1,x2,y2,c=‘black’,size=1):

t.color(c)

t.pensize(size)

t.pu()

t.goto(x1,y1)

t.pd()

t.goto(x2,y2)

def sanjiao(x,y,m,c,fc=‘black’):

t.color(fc,c)

t.pu()

t.goto(x,y)

t.pd()

t.seth(90)

t.begin_fill()

t.circle(m,180)

t.end_fill()

def tuoyuan(x,y,st,s,c,b,ps=1,ang=0):

t.pensize(ps)

t.pu()

t.goto(x,y)

t.pd()

t.seth(ang)



a=st

t.color(c,b)

t.begin_fill()

for i in range(120):

    if 0<=i<30 or 60<=i<90:

        a+=0.01*s

        t.lt(3)

        t.fd(a)

    else:

        a-=0.01*s

        t.lt(3)

        t.fd(a)

t.end_fill()

def head():

tuoyuan(0,-44,7.0,0.0,'black','#00A0DE')

tuoyuan(0,-49,6.0,0.03,'black','white')

def eyes():

tuoyuan(-25,133,1.0,4.0,'black','white')

tuoyuan(32,133,1.0,4.0,'black','white')

tuoyuan(-15,161,0.0,2,'black','black',1)          

tuoyuan(23,161,0.0,2,'black','black',1)

tuoyuan(-15,161,0.0,1,'black','white',1)    

tuoyuan(23,161,0.0,1,'black','white',1)    

def huzi():

tuoyuan(-77,118,0.7,0,'#FFC5C8','#FFC5C8')

tuoyuan(75,113,0.7,0,'#FFC5C8','#FFC5C8')    

line2(-53,118,-136,149)

line2(-50,95,-146,95)

line2(-51,78,-139,52)

line2(54,118,135,145)

line2(55,95,150,95)

line2(52,79,141,53)  

def nose():

tuoyuan(4,100,1,0.1,'black','#DB3A49')

#line2(4,101,4,43)

t.color('black')

t.pu()

t.goto(4,101)

t.seth(-80)

t.pd()

t.circle(-300,12)



tuoyuan(15,117,0.0,1.0,'white','white',1)  

def setting():

t.delay(0)  

t.ht()

#t.bgpic('./DLAM.gif')

t.pensize(2)

t.color('blue')

t.bgcolor('white')



t2.ht()

t2.pu()

t2.goto(0,-280)

def mouth():

t.pu()

t.goto(-73,59)

t.seth(-24)

t.pd()

t.color('black','#E92A14')

t.begin_fill()

t.circle(200,45)

t.seth(-98)   

t.circle(-77,165)

t.end_fill()



t.pu()

t.goto(-32,2)

t.seth(24)

t.pd()

t.color('black','#E74810')

t.begin_fill()

t.circle(-150,35)

t.seth(-130)   

t.circle(-70,90)

t.end_fill()

def xianglian():

t.pu()

t.goto(-66,-30)

t.pd()

t.color('black','#F53338')

t.begin_fill()

t.seth(-15)

t.circle(260,26)

t.seth(-80)

t.fd(10)

t.seth(-167)

t.circle(-240,30)  

t.seth(80) 

t.fd(12)

t.end_fill()

def lingdang():

tuoyuan(-10,-80,1.0,0.1,'black','#FFD957',1)

line2(-30,-60,10,-60,c='#E89F10',size=3)          

line2(-10,-70,-10,-80,c='black') 



t.pu()

t.goto(-10,-70)

t.pd()

t.color('black')

t.begin_fill()

t.seth(0)

t.circle(2.5)

t.end_fill()  



t.pu()

t.goto(-3,-50)  

t.pd()

t.pensize(3)

t.color('white')

t.seth(-50)

t.circle(-100,2)

def dupi():

t.pu()

t.goto(-50,-40)

t.pd()

t.color('black','white')

t.begin_fill()

t.seth(-140)

t.circle(60,280)

t.end_fill()



t.pu()

t.goto(-40,-90)

t.pd()

t.color('black','white')

t.begin_fill()

t.seth(0)

t.fd(60)

t.seth(-90)

t.circle(-30,180)

t.end_fill()  

def body():

t.color('black','#00A0DE')

t.pu()

t.goto(-73,-40)

t.pd()



t.begin_fill()

t.seth(-140)

t.circle(360,15)

t.seth(-40)  

t.fd(40) 



t.pu()

t.goto(-89,-84)

t.pd()

t.seth(-90)

t.circle(360,15)



t.pu()

t.goto(53,-176)

t.pd()



t.seth(80)

t.circle(360,15)





t.pu()

t.goto(76,-134)

t.pd()

t.seth(40)  

t.fd(40) 

t.seth(120)

t.circle(330,15)

t.end_fill()





sanjiao(2,-178,10,'white')

def feet():

t.pu()

t.goto(-113,-135)

t.pd()

t.color('black','white')

t.begin_fill()

t.seth(0)

t.circle(23)

t.end_fill()    



t.pu()

t.goto(85,-135)

t.pd()

t.color('black','white')

t.begin_fill()

t.seth(0)

t.circle(23)

t.end_fill()





tuoyuan(-13,-192,1.0,5.0,'black','white',ang=90)

tuoyuan(63,-192,1.0,5.0,'black','white',ang=90)

def cat_name():

t.pu()

t.goto(-150,230)

t.color('#0180DD')

t.write('哆啦A梦',font=('宋体',24,'normal'))   

setting()

head()

eyes()

nose()

mouth()

huzi()

body()

dupi()

xianglian()

feet()

lingdang()

cat_name()

t.hideturtle() # 隐藏图标
t.done() # 绘画结束,停留在当前界面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

易软科技(河源)有限公司

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

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

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

打赏作者

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

抵扣说明:

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

余额充值