700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > pythonturtle库画图_python 用turtle库画图

pythonturtle库画图_python 用turtle库画图

时间:2019-03-02 17:45:45

相关推荐

pythonturtle库画图_python 用turtle库画图

"""

Created on Tue Oct 30 21:46:05

@author: 木公子

"""

import turtle as t

t.pensize(2)

t.colormode(255)

t.setup(800,600)

t.speed(0)

t.Turtle().screen.delay(0)

#书

t.pu()

t.goto(-310,150)

t.pd()

t.seth(15) # 笔的角度为-30°

t.begin_fill() # 外形填充的开始标志

t.color("black",(153,153,101))

a=1.3

for i in range(90):

a-=0.005

t.fd(a)

t.rt(0.5)

t.seth(-90)

t.fd(40)

a=1.3

for i in range(70):

a-=0.005

t.fd(a)

t.lt(0.15)

t.seth(180)

a=1.3

for i in range(80):

if(i<=20):

a-=0.005

t.fd(a)

t.rt(0.5)

else:

a+=0.005

t.fd(a)

t.lt(0.5)

t.goto(-310,150)

t.end_fill()

#手

t.pu()

t.goto(-240,50)

t.pd()

t.seth(45)

t.begin_fill()

t.color("black",(250,209,189))

t.fd(28)

t.seth(0)

t.fd(10)

t.seth(-45)

t.fd(15)

t.seth(-60)

t.fd(13)

t.seth(180)

t.circle(15,86)

t.seth(105)

t.fd(24)

t.seth(45)

t.fd(8)

t.seth(-135)

t.fd(17)

t.pu()

t.goto(-240,50)

t.pd()

t.seth(-60)

t.circle(12,130)

t.end_fill()

#橘色衣服

t.pu()

t.goto(-209,37)

t.pd()

t.begin_fill()

t.color("black",(255,213,75))

t.seth(-90)

t.fd(15)

t.seth(-19)

t.fd(100)

t.seth(93)

a=1

for i in range(20):

t.fd(a)

t.rt(1)

t.seth(180)

t.circle(-20,90)

t.seth(160)

t.fd(70)

t.seth(-30)

t.circle(-40,30)

t.end_fill()

#头发

t.pu()

t.goto(-130,138)

t.pd()

t.begin_fill()

t.seth(67)

t.color("black","black")

t.circle(-136,105)

t.end_fill()

t.pu()

t.goto(-111,6)

t.pd()

t.begin_fill()

t.color("black",(252,158,8))

t.seth(-105)

for i in range(100):

t.fd(0.1)

t.lt(0.02)

t.seth(-80)

for i in range(200):

t.fd(0.1)

t.lt(0.02)

t.seth(0)

for i in range(50):

t.fd(1)

t.rt(0.05)

t.hideturtle()

t.end_fill()

t.pu()

t.goto(-133.5,28.5)

t.pd()

t.begin_fill()

t.color("black",(250,207,190))

t.seth(93)

t.circle(-20,110)

t.seth(170)

t.circle(20,30)

t.seth(125)

t.circle(-80,30)

t.seth(95)

for i in range(300):

t.fd(0.1)

t.rt(0.04)

t.circle(-65,60)

t.seth(80)

t.circle(-30,30)

t.seth(-85)

t.fd(13)

t.seth(45)

t.circle(-110,40)

t.seth(95)

t.fd(14)

t.seth(-52)

t.fd(18)

t.seth(0)

t.fd(30)

t.seth(0)

t.circle(-82,90)

for i in range(500):

t.fd(0.1)

t.rt(0.04)

for i in range(500):

t.fd(0.09)

t.lt(0.07)

t.seth(-89)

t.circle(-72,90)

for i in range(600):

t.fd(0.1)

t.rt(0.02)

t.circle(-104,47)

t.seth(160)

for i in range(200):

t.fd(0.1)

t.rt(0.07)

t.circle(-12,15)

t.hideturtle()

t.end_fill()

t.pu()

t.goto(-50,80)

t.pd()

t.begin_fill()

t.color("black",(255,255,255))

t.seth(0)

t.circle(20)

t.pu()

t.goto(20,80)

t.pd()

t.circle(20)

t.end_fill()

t.pu()

t.goto(-40,90)

t.pd()

t.begin_fill()

t.color("black",(0,0,0))

t.seth(0)

t.circle(10)

t.end_fill()

t.pu()

t.goto(10,90)

t.pd()

t.begin_fill()

t.color("black",(0,0,0))

t.seth(0)

t.circle(10)

t.end_fill()

t.pu()

t.goto(-35,30)

t.pd()

t.begin_fill()

t.color("black",(255,255,255))

t.seth(-60)

t.circle(35,120)

t.end_fill()

t.pu()

t.goto(540,-320)

t.pd()

t.write(‘木公子‘,font = (‘华文隶书‘ ,10 ,‘q‘,9,‘normal‘))

t.pendown()

#隐藏画笔箭头

t.hideturtle()

#关闭turtle

t.done()

原文:/mugongzi/p/9955591.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。