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

运行效果

相关推荐
用户70887690393815 分钟前
给传统 SaaS 增加 AI 能力:3个真实落地场景
python
卷无止境16 分钟前
FastAPI中间件全解析:请求处理链条上的隐形关卡
后端·python·fastapi
用户03321266636720 分钟前
使用 Python 将 HTML 内容添加到 PowerPoint 演示文稿中
python·html
看浪的路人21 分钟前
第4讲:MCP Client 开发——连接、发现、调用
windows·python·ai
snow@li27 分钟前
SpringBoot:AOP日志切面全景梳理/原理+流程+实战+避坑
java·开发语言·spring boot
Nil20828 分钟前
C++ emplace_back 与 push_back 详解
开发语言·c++
Swift社区29 分钟前
Python 开发环境怎么选?PyCharm、VS Code、Trae 谁更适合 AI 开发?
人工智能·python·pycharm
卷无止境32 分钟前
聊聊Web开发里的流式数据 从原理到FastAPI实战
后端·python·fastapi
SMF191933 分钟前
【PyCharm】让 PyCharm 使用 .venv 虚拟环境
ide·python·pycharm
修远客38 分钟前
感知模块:Agent的眼睛和耳朵 — 三层降级策略让Agent永不"失明"
python·agent