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()

效果图如下:

相关推荐
ok_hahaha10 分钟前
java从头开始-黑马点评-Redission
java·开发语言
无巧不成书021811 分钟前
Java面向对象零基础实战:从Employee类吃透自定义类核心,掌握封装精髓
java·开发语言·java入门·面向对象·自定义类·employee类·java核心技术
跃上青空25 分钟前
Java如何优雅的使用fastjson2进行枚举序列化/反序列化,欢迎探讨
java·开发语言
老李的勺子26 分钟前
Agent 记忆失效的 5 种方式:完整排查复盘
python·llm
Leo6553540 分钟前
动态透视报表 + 查询接口 + Excel导出
开发语言·windows·python
清水白石00842 分钟前
pytest Fixture 设计实战指南:作用域、依赖链、自动清理与测试资源高效复用
python·pytest
BioRunYiXue1 小时前
Nature Methods:CellVoyager 自主 AI 智能体开启生物数据分析新时代
大数据·开发语言·前端·javascript·人工智能·数据挖掘·数据分析
tottoramen1 小时前
如何安装龙虾
python
QC·Rex1 小时前
AI Agent 任务规划实战:从 ReAct 到 Plan-and-Solve 的完整指南
人工智能·python·react