pythonturtle库画图_python 用turtle库画图

"""

Created on Tue Oct 30 21:46:05 2018

@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()

原文:https://www.cnblogs.com/mugongzi/p/9955591.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值