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

运行效果

相关推荐
martian66511 分钟前
信创时代技术栈选择与前景分析:国产替代背景下的战略路径与实践指南
开发语言·科技·系统安全·创业创新
aiweker18 分钟前
数据分析(四):Python Pandas数据输入输出全流程指南
python·数据分析·pandas
赵谨言19 分钟前
基于深度学习的医疗诊断辅助系统设计
经验分享·毕业设计
{⌐■_■}19 分钟前
【计网】认识跨域,及其在go中通过注册CORS中间件解决跨域方案,go-zero、gin
java·linux·开发语言·c++·中间件·golang·gin
晨曦54321027 分钟前
Numpy数组与矩阵——python学习
python·矩阵·numpy
ErizJ27 分钟前
Golang|外观模式和具体逻辑
开发语言·golang·外观模式
ErizJ29 分钟前
Golang | 集合求交
开发语言·后端·golang·集合·交集
梓羽玩Python30 分钟前
7.8K 标星!这个Python神器把MCP服务器变成「搭积木」一样简单!
python·github
代码程序猿RIP34 分钟前
【C语言干货】回调函数
c语言·开发语言·数据结构·c++·算法
a小胡哦1 小时前
TensorFlow深度学习框架:从入门到精通的完整指南
pytorch·python·github·tensorflow