奸笑脸
from turtle import*#库引用
setup(1000,800,200,0)#setup(width,height,startx,starty)
speed(20)#绘图速度
#脸
penup()#拿起画笔
goto(-300,0)#去到对应坐标的点
seth(-90)#朝向
pendown()#放下笔
pencolor('orange')#画笔颜色,RGB颜色
pensize(5)#画笔大小
begin_fill()#开始填充
circle(300,360)#半径300旋转360度
fillcolor('yellow')#填充颜色,线要能组成密闭图形
end_fill()#结束填充
#嘴
pencolor('black')
pensize(10)
penup()
goto(-250,-30)
pendown()
seth(-90)
circle(250,180)
seth(150)
circle(200,15)
penup()
goto(250,-30)
pendown()
seth(-30)
circle(200,8)
#左眼
penup()
pensize(4)
goto(-230,100)
pendown()
seth(225)
begin_fill()
circle(20,90)
circle(100,90)
circle(20,90)
seth(135)
circle(100,90)
fillcolor('white')
end_fill()
penup()
pensize(20)
goto(-130,100)
pendown()
circle(2,360)
#右眼
penup()
pensize(4)
goto(100,100)
pendown()
seth(225)
begin_fill()
circle(20,90)
circle(100,90)
circle(20,90)
seth(135)
circle(100,90)
fillcolor('white')
end_fill()
penup()
pensize(20)
goto(140,100)
pendown()
circle(2,360)
#鼻子
penup()
pensize(2)
goto(0,0)
pendown()
seth(-95)
begin_fill()
fd(100)
seth(0)
fd(20)
seth(95)
fd(100)
fillcolor('pink')
end_fill()
#右眉毛
penup()
goto(320,150)
pendown()
seth(91)
for a in range(3):
pensize(a+5)
circle(50,30)#range(3)产生0,1,2的序列
for b in range(4):
pensize(b+8)
circle(250,10)
#左眉毛
penup()
goto(-320,150)
pendown()
seth(89)
for a in range(3):
pensize(a+5)
circle(-50,30)
for b in range(4):
pensize(b+8)
circle(-250,10)
#头顶
penup()
goto(0,300)
pendown()
pensize(2)
seth(90)
fd(40)
seth(0)
begin_fill()
circle(20,360)
fillcolor('green')
end_fill()
hideturtle()#隐藏画笔
done()#有此行运行时窗口不会自行关闭
效果图
来源:CSDN
作者:蓝天呀
链接:https://blog.csdn.net/weixin_46424753/article/details/104599948