一、生成图
新手实验,请勿喷
二、使用步骤
1.引入库
import turtle as t
t.screensize(2000,2000)
t.pensize(4)
t.hideturtle()
t.pencolor('black')
t.speed(10)
总代码
// An highlighted block
import turtle as t
t.screensize(2000,2000)
t.pensize(4)
t.hideturtle()
t.pencolor('black')
t.speed(10)
#填充颜色
t.colormode(255)
t.fillcolor(224,190,4)
t.setup(840, 500)
t.speed(20)
# 鼻子
#轮廓
t.begin_fill()
#一、脖子
t.pu()
t.goto(200, 0)
t.pd()
t.seth(-90)
t.fd(20)
t.seth(-30)
t.circle(200,60)
t.seth(90)
t.fd(20)
t.end_fill()
#二、下吧
t.begin_fill()
t.seth(0)
t.circle(250,16)
t.seth(80)
a=1
for i in range(60):
a=a+0.12
t.seth(80+i/3)
t.fd(a)
t.penup()
t.goto(200,0)
t.goto(200,-20)
t.pendown()
t.seth(90)
t.fd(20)
t.seth(-180)
t.circle(-250,16)
t.seth(100)
a=1
for i in range(60):
a=a+0.12
t.seth(100-i/3)
t.fd(a)
pos1=t.pos()
t.end_fill()
t.goto(pos1)
#头发
t.begin_fill()
t.setheading(90)
t.circle(-100,30)
t.right(90)
t.circle(-100,30)
t.setheading(90)
t.circle(-100,30)
t.right(90)
t.circle(-100,30)
t.setheading(90)
t.circle(-100,30)
t.right(80)
t.circle(-100,32)
t.penup()
t.goto(458,285)
t.pendown()
t.end_fill()
#右边头发
t.begin_fill()
t.setheading(90)
t.circle(100,30)
t.left(90)
t.circle(100,30)
t.setheading(90)
t.circle(100,30)
t.left(90)
t.circle(100,30)
t.setheading(90)
t.circle(100,30)
t.left(80)
t.circle(100,32)
t.end_fill()
t.penup()
#脸部颜色填充
t.goto(200,0)
t.begin_fill()
t.goto(400,0)
t.goto(458,285)
t.goto(143,290)
t.goto(200,0)
t.end_fill()
#填充颜色(白)
t.colormode(255)
t.fillcolor(224,224,224)
#左眼睛
t.begin_fill()
t.pensize(5)
t.goto(260,170)
t.pendown()
t.seth(90)
t.circle(70)
t.end_fill()
t.penup()
t.colormode(255)
t.fillcolor(0,0,0)
t.begin_fill()
t.goto(190,190)
t.seth(180)
t.circle(12)
t.end_fill()
#右眼睛
t.colormode(255)
t.fillcolor(224,224,224)
t.begin_fill()
t.penup()
t.goto(450,170)
t.pendown()
t.seth(90)
t.circle(70)
t.end_fill()
t.penup()
t.colormode(255)
t.fillcolor(0,0,0)
t.pensize(5)
t.begin_fill()
t.goto(380,190)
t.pendown()
t.seth(180)
t.circle(10)
t.end_fill()
#鼻子
t.colormode(255)
t.pencolor('black')
t.pensize(5)
t.fillcolor(224,190,4)
t.begin_fill()
t.penup()
t.goto(270,170)
t.pendown()
t.seth(180)
t.circle(30,270)
t.penup()
t.circle(30,90)
t.end_fill()
#嘴巴
t.goto(190,80)
t.pendown()
t.seth(-100)
t.circle(80,30)
t.penup()
t.circle(80,140)
t.pendown()
t.circle(80,30)
t.penup()
t.goto(188,65)
t.pendown()
t.seth(-16)
t.circle(300,30)
t.done()