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

运行效果

相关推荐
HAPPY酷几秒前
std::pair` 与 `std::map` 基础
开发语言·c++·算法
懒神降世几秒前
基于iVentoy的PXE服务器的部署实战指南
运维·服务器·开发语言·云原生·vmware·openeuler·iventoy
山东布谷网络科技6 分钟前
对标Yalla和Chamet:海外直播语聊APP中多人派对房的关键技术细节
java·开发语言·人工智能·php·语音识别·软件需求·海外电商系统开发
Dxy123931021613 分钟前
Python 将 JSON 字符串转换为字典
前端·python·json
喜欢吃燃面14 分钟前
基础算法:高精度
开发语言·c++·学习·算法
3GPP仿真实验室14 分钟前
【Matlab源码】6G候选波形:OFDM-IM 增强仿真平台 GIM、MM、IQ
开发语言·网络·matlab
xuxie9915 分钟前
【无标题】
java·开发语言
堕27415 分钟前
java数据结构当中的《Lambda表达式》
java·数据结构·python
叫我一声阿雷吧18 分钟前
【JS实战案例】实现图片懒加载(基础版)原生JS+性能优化,新手可直接复现
开发语言·javascript·性能优化·js图片懒加载
摇滚侠18 分钟前
基于 session 的登录认证方式,基于 token 的登录认证方式,对比
java·开发语言·intellij-idea