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

运行效果

相关推荐
用户835629078051几秒前
如何使用 Python 在 Word 文档中创建和格式化列表
后端·python
码林鼠4 分钟前
flutter状态管理入门教程-Riverpod
开发语言·javascript·flutter
system_error_x40 分钟前
C++ 编程基础入门教程
开发语言·c++
羡林i44 分钟前
ProcessPoolExecutor 传参踩坑实测:pickle 失败的四种写法
python
Amos_Web44 分钟前
Markdonw语法
开发语言·前端·javascript
Dmz丶1 小时前
前端转 AI 100 天 Day 30:正式上线——从零部署一个完整服务(含 30 天复盘)
python
Wang's Blog1 小时前
Java 项目实战: 交友项目 - 回顾和今日内容介绍
java·开发语言·交友
稻草人4781 小时前
安装OCA模块
python
用户5065659277761 小时前
回测引擎的五个工程细节:3000 根 4 小时 K 线跑出来的成本差
python
三垣网安1 小时前
漏洞实战|高校虚拟实验平台报错型 SQL 注入漏洞复现
网络·经验分享·sql·安全·web安全·网络安全·水平越权