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

运行效果

相关推荐
zh_xuan10 小时前
kotlin 类委托
开发语言·kotlin
墨雨晨曦8810 小时前
2026/01/20 java总结
java·开发语言
52Hz11810 小时前
二叉树理论、力扣94.二叉树的中序遍历、104.二叉树的最大深度、226.反转二叉树、101.对称二叉树
python·算法·leetcode
look ahead to10 小时前
关于PYQT qt designer的网格布局 单控件占多行的处理
开发语言·qt·pyqt
王德博客10 小时前
【C++继承】笔试易错题目
开发语言·c++·继承
卖个几把萌10 小时前
解决 Python 项目依赖冲突:使用 pip-tools 一键生成现代化的 requirements.txt
开发语言·python·pip
黎雁·泠崖10 小时前
Java字符串入门:API入门+String类核心
java·开发语言·python
哈哈不让取名字11 小时前
用Pygame开发你的第一个小游戏
jvm·数据库·python
程序员敲代码吗11 小时前
Python异步编程入门:Asyncio库的使用
jvm·数据库·python
MediaTea11 小时前
Python:MRO 解密 —— C3 线性化算法
java·开发语言