python的turtle画图玫瑰花
时间: 2024-01-04 16:20:41 浏览: 102
使用Python的turtle模块绘制玫瑰花图案(含详细Python代码与注释)
5星 · 资源好评率100%
以下是使用Python的turtle库绘制玫瑰花的代码示例:
```python
import turtle
# 设置画布和画笔
canvas = turtle.Screen()
canvas.bgcolor("white")
pen = turtle.Turtle()
pen.color("red")
pen.speed(0)
# 绘制玫瑰花
for i in range(180):
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward(1)
pen.right(1)
pen.forward
阅读全文