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

运行效果

相关推荐
Cenxi6 分钟前
Python字符串方法练习手册
人工智能·python
liliangcsdn11 分钟前
因子权重矩阵处理-因子权重收缩Shrinkage算法的探索
开发语言·python·机器学习
用户83562907805118 分钟前
使用 Python 在 Excel 中添加和编辑形状
后端·python
2601_9623004730 分钟前
python在运维上可以干什么,请举几个具体的例子
运维·python·系统管理·网络监控·自动化脚本
小刘在重生~43 分钟前
Java 异常体系完整笔记
java·笔记·python
用户8356290780511 小时前
使用 Python 为 PDF 添加和管理超链接
后端·python
千千寰宇1 小时前
[Python/测试] pytest:简洁、可扩展的 Python 测试框架
python·软件质量保障与测试
少陽君1 小时前
Python 并发编程:IO 等待用线程/asyncio,CPU 计算才用进程
数据库·python·php
aramae1 小时前
模拟实现strstr函数(C语言)
c语言·开发语言·算法
2601_962284501 小时前
Python 和Java 哪个更适合做自动化测试?
java·自动化测试·python·接口测试·性能测试