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

运行效果

相关推荐
三8442 分钟前
redis三大机制:配置、持久化、主从复制(getshell 原理地基)
开发语言·php
万年咸鱼7 分钟前
Java PrintStream 详解:从基础用法到实战技巧
java·开发语言·python
cui_ruicheng20 分钟前
FastAPI 应用开发(二):请求响应、Pydantic 模型与依赖注入
python·fastapi·web
guwentian23 分钟前
手撕 MCP:用 TypeScript 从零写一个能跑的最小客户端(附可运行 demo)
开发语言·nodejs·mcp
DeepVisionary33 分钟前
SoundHound 完成收购 LivePerson:股权对价 4300 万美元,实际总成本约 3.04 亿
python·自动化
deepseek231 小时前
Google Gemini Agentic Video 上线:88% 少 token 的主动取样如何改写长视频理解
python·多模态·ai agent·gemini·视频理解
秋田君1 小时前
Qt_串口编程
开发语言·qt
worilb1 小时前
Java/JVM 常见诊断文件对比
java·开发语言
ttwuai1 小时前
Go 后台初始化 MySQL 脚本失败怎么办?先查 DDL 还是生成配置
开发语言·mysql·golang
Zane19941 小时前
只重写了 __eq__,为什么类突然变得不可哈希了?常用魔法方法大盘点
后端·python