用turtle浪漫点的表白
时间: 2024-05-12 19:15:28 浏览: 35
好的,我来帮你设计一个浪漫的表白场景:
首先,我们让海龟画一个大大的心形。
```python
import turtle
turtle.color('red')
turtle.begin_fill()
turtle.left(50)
turtle.forward(100)
turtle.circle(40, 180)
turtle.left(260)
turtle.circle(40, 180)
turtle.forward(100)
turtle.end_fill()
```
然后,在心形中央写上你的名字和TA的名字。
```python
turtle.penup()
turtle.goto(0, 20)
turtle.write("我喜欢你", align="center", font=("Arial", 24, "normal"))
turtle.goto(0, -10)
turtle.write("XXX", align="center", font=("Arial", 24, "normal"))
turtle.goto(0, -40)
turtle.write("XXX", align="center", font=("Arial", 24, "normal"))
```
接下来,我们让海龟画一些漂亮的花朵和爱心。
```python
turtle.color('pink')
turtle.fillcolor('yellow')
turtle.penup()
turtle.goto(-150, 150)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(-100, 200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(-50, 150)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(0, 200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(50, 150)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(100, 200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(150, 150)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.color('red')
turtle.penup()
turtle.goto(0, -70)
turtle.pendown()
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(0, -60)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
turtle.penup()
turtle.goto(10, -50)
turtle.pendown()
turtle.right(45)
turtle.forward(20)
turtle.left(135)
turtle.forward(20)
turtle.penup()
turtle.goto(-10, -50)
turtle.pendown()
turtle.right(135)
turtle.forward(20)
turtle.left(135)
turtle.forward(20)
```
最后,我们让海龟写下一段浪漫的话语。
```python
turtle.penup()
turtle.goto(0, -120)
turtle.write("愿我们的爱情天长地久", align="center", font=("Arial", 24, "normal"))
```
现在,这个浪漫的表白场景就完成了,你可以把代码复制到Python编辑器中运行,看看效果如何。祝你成功表白!
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.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)
![](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)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)