Python制作表白爱心合集

 更新时间:2022年01月22日 11:41:27   作者:木木子学python  
这篇文章主要介绍了几个表白小项目合集,有爱心表白、爱心树等。文中的示例代码讲解详细,对我们学习Python有一定的价值,需要的可以参考一下

导语

"盘子里最后一块肉给你 一 冰激凌的第一口给你 一手机最后的10%电量给你!"

哈喽大家好!我是木木子,我要开始给大家放大招啦

你来之后,苦都不太苦,甜都特别甜

如果人类有尾巴的话,说起来有点不好意思 ,只要和你在一起,一定会止不住摇起来

我害怕你找不到我,所以我要藏在你心里

I love three things in the world.The sun,the moon and you.The sun for the day,the moon for the night,and you for ever.

浮世万千,吾爱有三。日,月与卿。日为朝,月为暮,卿为朝朝暮暮。

下面这几套表白小项目送给大家 希望大家喜欢​

正文

一、爱心表白:做我女朋友吧,行就行,不行我再想想办法

1)效果展示

2)附主程序

t=turtle.pen()
t=turtle
t.up()
t.goto(0,150)
t.down()
t.color('pink')
t.begin_fill()
t.fillcolor('pink')
t.speed(1)
t.left(45)
t.forward(150)
t.right(45)
t.forward(100)
t.right(45)
t.forward(100)
t.right(45)
t.forward(100)
t.right(45)
t.forward(250+math.sqrt(2)*100)
t.right (90)
t.speed(2)
t.forward(250+100*math.sqrt(2))
t.right(45)
t.forward(100)
t.right(45)
t.forward(100)
t.right(45)
t.forward(100)
t.right(45)
t.forward(150)
t.end_fill()
t.goto(-10,0)
t.pencolor('white')
#L
t.pensize(10)
t.goto(-50,0)
t.goto(-50,80)
t.up ()
#I
t.goto(-100,0)
t.down()
t.goto(-160,0)
t.goto(-130,0)
t.goto(-130,80)
t.goto(-160,80)
t.goto(-100,80)
t.up()
#O
t.goto(10,25)
t.down()
t.right(45)
t.circle(25,extent=180)
t.goto(60,55)
t.circle(25,extent=180)
t.goto(10,25)
t.up()
t.goto(75,80)
t.down()
t.goto(100,0)
t.goto(125,80)
t.up()
t.goto(180,80)
t.down()
t.goto(140,80)
t.goto(140,0)
t.goto(180,0)
t.up()
t.goto(180,40)
t.down()
t.goto(140,40)
#U
t.up()
t.goto(-40,-30)
t.down()
t.goto(-40,-80)
t.circle(40,extent=180)
t.goto(40,-30)
t.hideturtle()
a=input()

二、爱心表白:🧡有两个心愿:你在身边,在你身边

1)效果展示

2)附主程序

pen = turtle.Turtle()
pen.hideturtle()

pen.fillcolor('pink')
pen.begin_fill()

# set the starting direction
pen.left(110)

# draw the left bottom part
while pen.heading() < 140:
    # rotate & forward
    pen.left(1)
    pen.forward(2)

# move up
pen.forward(90)

# draw the left upper part
while pen.xcor() < 0:
    pen.right(0.8)
    pen.forward(1)

# go back to the starting point, and do the right part as a mirror
pen.up()
pen.goto(0, 0)
pen.down()

# set the direction
pen.setheading(70)

# draw the right bottom part
while pen.heading() > 40:
    # Defining step by step curve motion
    pen.right(1)
    pen.forward(2)

# move up
pen.forward(90)

# draw the right upper part
while pen.xcor() > 0:
    print(pen.xcor())
    pen.left(0.8)
    pen.forward(1)

# Ending the filling of the color
pen.end_fill()

三、爱心表白:君初相识,犹如故人归。天涯明月新,朝暮最相思

1)效果展示​

2)附主程序

import turtle as t

def heart(x,y,z):    # 绘制爱心
    t.pensize(2)
    t.pencolor("black")
    if z == 1:
        t.fillcolor("red")
    elif z == 0:
        t.fillcolor("pink")
    t.begin_fill()     #左半边
    t.penup()
    t.goto(x,y)
    t.pendown()
    t.circle(50,180)
    t.circle(180,37)
    t.left(46)      #右半边
    t.circle(180,37)
    t.circle(50, 182)
    t.end_fill()
def arrow1(x,y):
   t.pensize(5)
    t.pencolor("black")
    t.fillcolor("brown")
    t.penup()
    t.goto(x, y)
    t.pendown()
    t.setheading(210)
    t.forward(150)
    t.begin_fill()
    t.left(30)
    t.forward(20)
    t.right(30)
    t.forward(50)
    t.right(150)
    t.forward(20)
    t.left(120)
    t.forward(20)
    t.right(150)
    t.forward(50)
    t.right(30)
    t.forward(20)
    t.end_fill()
def arrow2(x, y):
    t.pensize(5)
    t.pencolor("black")
    t.fillcolor("brown")
    t.penup()
    t.goto(x, y)
    t.pendown()
    t.begin_fill()
    t.setheading(30)
    t.forward(100)
    t.left(90)
    t.forward(8)
    t.right(120)
    t.forward(16)
    t.right(120)
    t.forward(16)
    t.right(120)
    t.forward(8)
    t.end_fill()
def main():
    t.setheading(90)
    heart(50, 130, 0)
    t.setheading(120)
    heart(0, 100, 1)
    arrow1(-20, 60)
    arrow2(100, 130)
    t.hideturtle()
    t.exitonclick()

以上就是Python制作表白爱心合集的详细内容,更多关于Python表白爱心的资料请关注脚本之家其它相关文章!

相关文章

  • 使用SimpleITK读取和保存NIfTI/DICOM文件实例

    使用SimpleITK读取和保存NIfTI/DICOM文件实例

    这篇文章主要介绍了使用SimpleITK读取和保存NIfTI/DICOM文件实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2020-07-07
  • Python虚拟环境库virtualenvwrapper安装及使用

    Python虚拟环境库virtualenvwrapper安装及使用

    这篇文章主要介绍了Python虚拟环境库virtualenvwrapper安装及使用,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2020-06-06
  • 浅谈python str.format与制表符\t关于中文对齐的细节问题

    浅谈python str.format与制表符\t关于中文对齐的细节问题

    今天小编就为大家分享一篇浅谈python str.format与制表符\t关于中文对齐的细节问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2019-01-01
  • python中BackgroundScheduler和BlockingScheduler的区别

    python中BackgroundScheduler和BlockingScheduler的区别

    这篇文章主要介绍了python中BackgroundScheduler和BlockingScheduler的区别,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2021-07-07
  • python使用mysql的两种使用方式

    python使用mysql的两种使用方式

    pymsql是Python中操作MySQL的模块。这篇文章主要介绍了python使用mysql的两种使用方式,需要的朋友可以参考下
    2018-03-03
  • 如何使用Python 抓取和优化所有网站图像

    如何使用Python 抓取和优化所有网站图像

    我发布了一个通过FTP自动优化新图像的教程。这次我们将抓取整个网站,并在本地优化我们遇到的图像,按URL组织,怎么来操作呢,下面跟随小编一起学习使用Python 抓取和优化所有网站图像的方法,感兴趣的朋友一起看看吧
    2023-02-02
  • python列出目录下指定文件与子目录的方法

    python列出目录下指定文件与子目录的方法

    这篇文章主要介绍了python列出目录下指定文件与子目录的方法,涉及Python使用os模块与glob操作目录与文件的技巧,需要的朋友可以参考下
    2015-07-07
  • python按照多个条件排序的方法

    python按照多个条件排序的方法

    今天小编就为大家分享一篇python按照多个条件排序的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2019-02-02
  • python中openpyxl库用法详解

    python中openpyxl库用法详解

    openpyxl模块是一个读写Excel 文档的Python库,openpyxl是一个比较综合的工具,能够同时读取和修改Excel文档,这篇文章主要介绍了python中openpyxl库用法详解,需要的朋友可以参考下
    2022-09-09
  • Python 音频生成器的实现示例

    Python 音频生成器的实现示例

    这篇文章主要介绍了Python 音频生成器的实现示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2019-12-12

最新评论