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

运行效果

相关推荐
hhb_6182 分钟前
AIRAGDebug:一键定位RAG链路异常
人工智能·python·算法
朝朝辞暮i19 分钟前
C++ 第 6 课:switch —— 多状态选择
开发语言·c++·算法
小静AI工程实验室23 分钟前
asyncio.Queue 有界队列实战:背压、task_done、join 与异常收尾
python
小凡geo27 分钟前
本地商家 GEO:用脚本一键生成 FAQPage 结构化数据,让 AI 切片更稳
开发语言·人工智能·python·microsoft·搜索引擎·ai
Zhou14113629 分钟前
SpringBoot_03_Web开发
前端·spring boot·python
weixin1997010801636 分钟前
《1688物流API接口边界:logistics.trace.get 与 freight.template.list 的隐藏约束》(附Python源码)
windows·python·list
朝朝辞暮i43 分钟前
C++ 第 4 课:if / else —— 让程序自己做决定
开发语言·c++
波力海苔夹心脆6751 小时前
C# 值类型与引用类型详解:存储位置、赋值机制、参数传递、相等比较、装箱拆箱与常见陷阱
开发语言·jvm·经验分享·笔记·c#·.net
m0_380743871 小时前
Qt中导航栏实现的详细指南
开发语言·c++
mhmh1231 小时前
Python 对象模型与数据模型:魔术方法、描述符与元类深度解析
开发语言·python