如何用用turtle画出自己的姓名:严树菁。 要求:名字为严树菁, 写正楷字,不能连笔,不能倒划笔顺。
时间: 2023-06-25 18:02:59 浏览: 209
以下是使用Python的turtle库绘制严树菁姓名的代码:
```python
import turtle
# 设置画笔颜色和宽度
turtle.color('black')
turtle.pensize(3)
# 绘制“严”字
turtle.up()
turtle.goto(-200, 0)
turtle.down()
turtle.seth(0)
turtle.fd(80)
turtle.seth(135)
turtle.fd(113)
turtle.seth(45)
turtle.fd(80)
turtle.up()
turtle.goto(-165, 30)
turtle.down()
turtle.seth(0)
turtle.fd(40)
# 绘制“树”字
turtle.up()
turtle.goto(-70, 0)
turtle.down()
turtle.seth(90)
turtle.fd(100)
turtle.seth(0)
turtle.fd(40)
turtle.seth(-90)
turtle.fd(100)
turtle.seth(180)
turtle.fd(40)
# 绘制“菁”字
turtle.up()
turtle.goto(60, 0)
turtle.down()
turtle.seth(135)
turtle.fd(80)
turtle.seth(-45)
turtle.fd(80)
turtle.up()
turtle.goto(60, 30)
turtle.down()
turtle.seth(0)
turtle.fd(40)
# 隐藏画笔
turtle.hideturtle()
turtle.done()
```
运行该代码会弹出一个窗口,其中绘制了严树菁的姓名。可以根据需要调整画笔的颜色、宽度和位置等。
阅读全文
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)