python海龟绘图画碎冰蓝
时间: 2023-12-16 13:28:11 浏览: 156
以下是使用Python海龟绘图库绘制碎冰蓝的代码:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 600)
turtle.bgcolor("#87CEEB")
# 定义画笔
pen = turtle.Pen()
pen.speed(10)
pen.pensize(5)
# 绘制六边形
pen.color("#FFFFFF")
pen.begin_fill()
for i in range(6):
pen.forward(100)
pen.right(60)
pen.end_fill()
# 绘制内部三角形
pen.color("#00BFFF")
pen.begin_fill()
for i in range(3):
pen.forward(60)
pen.right(120)
pen.end_fill()
# 绘制外部三角形
pen.penup()
pen.goto(0, 100)
pen.pendown()
pen.color("#00BFFF")
pen.begin_fill()
for i in range(3):
pen.forward(60)
pen.right(120)
pen.end_fill()
# 隐藏画笔
pen.hideturtle()
# 显示绘图窗口
turtle.done()
```
阅读全文