python用turtle画一箭穿心
时间: 2023-11-19 15:03:48 浏览: 57
好的,让我来为您演示一下:
```python
import turtle
# 画箭体
turtle.pensize(10)
turtle.color('red', 'red')
turtle.begin_fill()
turtle.right(45)
turtle.forward(100)
turtle.right(-135)
turtle.forward(150)
turtle.right(135)
turtle.forward(100)
turtle.right(-135)
turtle.forward(50)
turtle.end_fill()
# 画箭头
turtle.pensize(10)
turtle.color('black', 'black')
turtle.begin_fill()
turtle.right(-45)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(135)
turtle.forward(150)
turtle.right(-135)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.end_fill()
# 画心
turtle.pensize(10)
turtle.color('red')
turtle.up()
turtle.goto(50, 20)
turtle.down()
turtle.right(45)
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
turtle.up()
turtle.goto(90, 20)
turtle.down()
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
turtle.up()
turtle.goto(70, 0)
turtle.setheading(270)
turtle.pensize(10)
turtle.down()
turtle.forward(40)
turtle.circle(-20,180)
turtle.done()
```
运行以上代码,即可看到一箭穿心的绘制效果。希望能够满足您的需求。
阅读全文