import turtle # 设置画布和画笔
screen = turtle.Screen()
screen.bgcolor("white")
pen = turtle.Turtle()
pen.speed(10)
pen.color("blue")
pen.penup() # 航母主体(简化为一个矩形)
pen.goto(-200, 0)
pen.pendown()
pen.begin_fill()
for _ in range(2): pen.forward(400) pen.right(90) pen.forward(100) pen.right(90)
pen.end_fill() # 航母甲板(简化为一个矩形)
pen.penup()
pen.goto(-190, 80)
pen.pendown()
pen.color("gray")
pen.begin_fill()
for _ in range(2): pen.forward(380) pen.right(90) pen.forward(40) pen.right(90)
pen.end_fill() # 航母上的飞机(简化为几个矩形)
pen.penup()
pen.goto(-150, 120)
pen.pendown()
pen.color("green")
for _ in range(3): pen.begin_fill() for _ in range(2): pen.forward(40) pen.right(90) pen.forward(20) pen.right(90) pen.end_fill() pen.penup() pen.forward(60) pen.pendown() # 隐藏画笔
pen.hideturtle() # 完成绘图,保持窗口打开
turtle.done()
以上是一个简化的方法,使用Python和turtle
模块来绘制一个大致类似航母形状的图形。