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

运行效果

相关推荐
光泽雨2 小时前
C# 中 Assembly 类详解
开发语言·c#
少控科技2 小时前
C#基础训练营 - 02 - 运算器
开发语言·c#
瞎某某Blinder3 小时前
DFT学习记录[4] 电子和空穴的有效质量计算全流程
python·学习
Riemann~~3 小时前
C语言嵌入式风格
c语言·开发语言
Liue612312313 小时前
基于YOLO11-C3k2-Faster-CGLU的路面落叶检测与识别系统实现
python
~央千澈~4 小时前
抖音弹幕游戏开发之第8集:pyautogui基础 - 模拟键盘操作·优雅草云桧·卓伊凡
网络·python·websocket·网络协议
占疏4 小时前
列表分成指定的份数
python
Gaosiy4 小时前
脑电python分析库MNE安装
python·脑机接口·脑电·mne
zmzb01034 小时前
C++课后习题训练记录Day104
开发语言·c++
zmzb01035 小时前
C++课后习题训练记录Day105
开发语言·c++·算法