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

效果图如下:

相关推荐
ITfeib6 分钟前
Flutter
开发语言·javascript·flutter
想躺平的咸鱼干42 分钟前
Volatile解决指令重排和单例模式
java·开发语言·单例模式·线程·并发编程
Owen_Q1 小时前
Denso Create Programming Contest 2025(AtCoder Beginner Contest 413)
开发语言·算法·职场和发展
·云扬·1 小时前
【Java源码阅读系列37】深度解读Java BufferedReader 源码
java·开发语言
liulilittle2 小时前
C++ i386/AMD64平台汇编指令对齐长度获取实现
c语言·开发语言·汇编·c++
巴里巴气2 小时前
selenium基础知识 和 模拟登录selenium版本
爬虫·python·selenium·爬虫模拟登录
19892 小时前
【零基础学AI】第26讲:循环神经网络(RNN)与LSTM - 文本生成
人工智能·python·rnn·神经网络·机器学习·tensorflow·lstm
JavaEdge在掘金2 小时前
Redis 数据倾斜?别慌!从成因到解决方案,一文帮你搞定
python
ansurfen2 小时前
我的第一个AI项目:从零搭建RAG知识库的踩坑之旅
python·llm
Thomas_YXQ2 小时前
Unity URP法线贴图实现教程
开发语言·unity·性能优化·游戏引擎·unity3d·贴图·单一职责原则