如何使用python实现画笑脸-成都快上网建站

如何使用python实现画笑脸

这篇文章主要介绍如何使用python实现画笑脸,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

成都创新互联公司是一家专注于成都做网站、网站建设、外贸营销网站建设与策划设计,泸县网站建设哪家好?成都创新互联公司做网站,专注于网站建设十余年,网设计领域的专业建站公司;建站业务涵盖:泸县等地区。泸县做网站价格咨询:18980820575

在Python中画笑脸可以使用turtle库实现。

1、打开idel,通过idel新建一个py文件,在空白的文件中输入下面的代码按F5运行此文件就可以画笑脸了。

from turtle import *
screensize(600,600)
speed(10)
 
#笑脸的小圆脸
pensize(5)
color('dim grey','yellow')
pu()
goto(0,-100)
begin_fill()
circle(100)
end_fill()
 
#腮红
#左侧
seth(90)
color('Light Pink','Light Pink')
pu()
goto(-55,-5)
pd()
begin_fill()
circle(20)
end_fill()
#右侧
color('Light Pink','Light Pink')
pu()
goto(55,-5)
pd()
begin_fill()
circle(-20)
end_fill()
 
#笑脸的眼睛
#左眼
color('dim grey','white')
pu()
goto(-10,22)
pd()
begin_fill()
circle(25)
end_fill()
#左瞳
color('dim grey','dim grey')
pu()
goto(-10,22)
seth(90)
pd()
begin_fill()
circle(25,-180)
end_fill()
#右眼
color('dim grey','white')
pu()
goto(10,22)
seth(90)
pd()
begin_fill()
circle(-25)
end_fill()
#右瞳
color('dim grey','dim grey')
pu()
goto(10,22)
seth(90)
pd()
begin_fill()
circle(-25,-180)
end_fill()
 
#笑脸的嘴巴
#左
pu()
goto(-4,-43)
seth(80)
pd()
circle(16,-200)
#右
pu()
goto(4,-43)
seth(110)
pd()
circle(-16,-185)
#连接
pu()
goto(4,-43)
seth(90)
pd()
circle(4,180)
 
hideturtle()

2、运行结果如下:

如何使用python实现画笑脸

以上是如何使用python实现画笑脸的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


新闻名称:如何使用python实现画笑脸
本文路径:http://kswjz.com/article/jspiee.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流