python速学教程(入门到精通)
python怎么学习?python怎么入门?python在哪学?python怎么学才快?不用担心,这里为大家提供了python速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
在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免费学习笔记(深入):立即学习
在学习笔记中,你将探索 Python 的核心概念和高级技巧!
已抢2127个
抢已抢2600个
抢已抢3108个
抢已抢4778个
抢已抢4185个
抢已抢34407个
抢