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

运行效果

相关推荐
麻瓜老宋3 小时前
AI开发C语言应用按步走,表达式计算器calc的第四步,交互式 REPL 模式
c语言·开发语言·atomcode
旅僧3 小时前
王树森老师强化学习--同声传译版3
python·深度学习
梦想不只是梦与想3 小时前
python中精度处理:decimal
python·float·精度丢失·decimal·浮点运算
猫猫不是喵喵.3 小时前
双亲委派机制与类加载过程
java·开发语言
大模型码小白3 小时前
向量化引擎与 AI 排障:当 SIMD 遇到异常检测,存储诊断的范式转移
java·大数据·数据库·人工智能·python
tinygone3 小时前
在Windows上部署Unlimited-ocr并提供给大模型使用
人工智能·windows·经验分享
布朗克1683 小时前
Go入门到精通-22-同步原语
开发语言·后端·golang·同步原语
雪的季节3 小时前
【无标题】
linux·服务器·python
帅次3 小时前
Kotlin Flow 与 StateFlow:UI 单向数据流基础
开发语言·ui·kotlin·stateflow·onlifecycle
艾伦野鸽ggg4 小时前
JavaScript 浏览器本地存储
开发语言·javascript·ecmascript