Python使用turtle画笑脸

python 复制代码
import turtle as t
t.pensize(5)            #设置画笔尺寸
t.color("red","yellow") #设置画笔颜色
t.begin_fill()          #开始填充
t.circle(150)           #绘制一个半径为100像素的圆
t.end_fill()            #结束填充

#画眼睛(左眼)
t.penup() #抬起画笔
t.goto(-40,170) #移动到指定坐标
t.pendown()
t.pensize(2)
t.color("black","black")
t.begin_fill()
t.circle(30)
t.end_fill()

#画眼睛(右眼)
t.penup()
t.goto(50,170)
t.pendown()
t.pensize(2)
t.color("black","black")
t.begin_fill()
t.circle(30)
t.end_fill()

#画嘴
t.penup()
t.goto(-55,120)
t.pendown()
t.right(90)
t.pensize(3)
t.color("red")
t.circle(60,180)
t.hideturtle()
t.done()

效果图如下:

相关推荐
小鹏编程15 小时前
C++ 周期问题 - 计算n天后星期几
开发语言·c++
繁华似锦respect15 小时前
C++ unordered_map 底层实现与详细使用指南
linux·开发语言·c++·网络协议·设计模式·哈希算法·散列表
太阳以西阿15 小时前
【计算机图形学】01 OpenGL+Qt
开发语言·qt
阿蔹15 小时前
JavaWeb-Selenium 配置以及Selenim classnotfound问题解决
java·软件测试·python·selenium·测试工具·自动化
稚辉君.MCA_P8_Java15 小时前
Gemini永久会员 C++返回最长有效子串长度
开发语言·数据结构·c++·后端·算法
Molesidy15 小时前
【C】简易的环形缓冲区代码示例
c语言·开发语言
万粉变现经纪人15 小时前
如何解决 pip install 代理报错 407 Proxy Authentication Required 问题
windows·python·pycharm·beautifulsoup·bug·pandas·pip
张np15 小时前
java基础-ArrayList
java·开发语言
李剑一16 小时前
Python学习笔记3
python
zmzb010316 小时前
C++课后习题训练记录Day42
开发语言·c++·算法