Python turtle海龟绘制美国队长盾牌

使用Python中的turtle模块绘制美队盾牌

具体思路如下:

  1. 导入海龟库
  2. 第1个圆:半径 200,红色填充
  3. 第2个圆:半径 150,白色填充
  4. 第3个圆:半径 100,红色填充
  5. 第4个圆:半径 50,蓝色填充

代码如下:(仅供参考,如有错误欢迎指正)

python 复制代码
# 导入海龟库
import turtle
t=turtle.Turtle()
t.shape('turtle')
t.speed(0)

# 第一个圆:红色,半径200
t.up()
t.goto(0,-200)
t.down()
t.color('red')
t.begin_fill()
t.circle(200)
t.end_fill()

# 第二个圆:白色,半径150
t.up()
t.goto(0,-150)
t.down()
t.color('white')
t.begin_fill()
t.circle(150)
t.end_fill()

# 第三个圆:红色,半径100
t.up()
t.goto(0,-100)
t.down()
t.color('red')
t.begin_fill()
t.circle(100)
t.end_fill()

# 第四个圆:蓝色,半径50
t.up()
t.goto(0,-50)
t.down()
t.color('blue')
t.begin_fill()
t.circle(50)
t.end_fill()

# 画五角星
t.up()
t.goto(-40,15)
t.down()
t.color('white')
t.begin_fill()
for i in range(5):
    t.forward(80)
    t.right(144)
t.end_fill()

# 海龟隐藏hideturtle、显示show
t.hideturtle()
t.hideturtle()

运行效果

相关推荐
用户9385156350719 分钟前
Text2SQL 实战:用 DeepSeek 大模型实现自然语言查询 SQLite 数据库
python·sqlite
2601_9620996834 分钟前
Python环境下中文分词实现与应用探索
python·自然语言处理·中文分词·jieba·开源社区
en.en..36 分钟前
C语言核心解析:#define与typedef本质区别
开发语言·c++·算法
2601_9669496542 分钟前
批量获取多只股票五档盘口的极简方案:QuantDash Python SDK 实战指南
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
用户0190275816143 分钟前
如何用 Python 监控 A 股涨停跌停与封板/炸板?
python
Lyra_Infra1 小时前
云效主机部署场景下 Python 服务生命周期问题复盘
后端·python
刀鋒偏冷1 小时前
CentOS 7 配置 Python 3.12.4 + RTX 4090 深度学习环境全记录
python·深度学习·centos
DreamLife☼1 小时前
Agent开发环境搭建完全指南
python·docker·typescript·node·工业知识点
李可以量化2 小时前
miniqmt 行情的备选方案 ---tdxrs(下)
python
点心的游戏开发世界2 小时前
GDScript 入门笔记:目录
开发语言·笔记·游戏引擎·godot