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

运行效果

相关推荐
字节跳动的猫15 小时前
2026四款AI 插件开发简化指南
经验分享
小北方城市网15 小时前
SpringBoot 集成 Redis 实战(缓存与分布式锁):提升系统性能与并发能力
spring boot·python·rabbitmq·java-rabbitmq·数据库架构
100编程朱老师16 小时前
fping命令详解
开发语言·php
yuhaiqun198916 小时前
SQL+VSCode实战指南:AI赋能高效数据库操作
数据库·人工智能·经验分享·vscode·sql·学习·学习方法
matlabgoodboy16 小时前
生信分析服务医学统计数据分子对接网络药理学单细胞测序r语言geo
开发语言·r语言
Pyeako16 小时前
opencv计算机视觉--传参方法&银行卡识别&身份证识别案例
人工智能·python·opencv·计算机视觉·身份证识别·银行卡识别·传参方法
夔曦16 小时前
【无标题】
python·强化学习算法
码农幻想梦16 小时前
实验六 AOP,JdbcTemplate及声明式事务
java·开发语言·数据库
是做服装的同学16 小时前
服装管理系统ERP是什么?它的主要功能与优势有哪些?
大数据·经验分享·其他
先做个垃圾出来………16 小时前
Python 中 kwargs.get() 方法详解
开发语言·python