用Python使用turtle库绘制“肖”
时间: 2023-05-23 13:06:00 浏览: 148
使用Python的turtle模块画图
A:
```python
import turtle
# 设置画笔
pen = turtle.Pen()
pen.pensize(6)
pen.color("red")
# 绘制“肖”
pen.goto(-70, 0)
pen.setheading(60)
pen.circle(50, 120)
pen.goto(-70, 0)
pen.setheading(-60)
pen.circle(-50, 120)
pen.goto(-70, 0)
pen.setheading(0)
pen.fd(140)
# 隐藏画笔
pen.hideturtle()
# 显示绘制结果
turtle.done()
```
运行结果如下:
![image](https://user-images.githubusercontent.com/57287660/119649438-49f5ec80-be5f-11eb-9dcf-d141bb72d64c.png)
阅读全文