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表白爱心的资料请关注脚本之家其它相关文章!

相关文章

  • python如何支持并发方法详解

    python如何支持并发方法详解

    这篇文章主要介绍了python如何支持并发,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2020-07-07
  • PyQt5实现登录页面

    PyQt5实现登录页面

    这篇文章主要为大家详细介绍了PyQt5实现登录页面,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-05-05
  • Python如何利用opencv实现手势识别

    Python如何利用opencv实现手势识别

    这篇文章主要介绍了Python如何利用opencv实现手势识别,文章围绕主题展开详细的内容介绍,具有一定的参考价值,需要的小伙可以参考一下
    2022-05-05
  • Python环境搭建以及Python与PyCharm安装详细图文教程

    Python环境搭建以及Python与PyCharm安装详细图文教程

    PyCharm是一种PythonIDE,带有一整套可以帮助用户在使用Python语言开发时提高其效率的工具,这篇文章主要给大家介绍了关于Python环境搭建以及Python与PyCharm安装的详细图文教程,需要的朋友可以参考下
    2024-03-03
  • python 中的pycrypto 算法加密

    python 中的pycrypto 算法加密

    这篇文章主要介绍了python 中的pycrypto 算法加密,文章基于python的相关资料展开对pycrypto 算法加密的详细介绍,需要的小伙伴可以参考一下
    2022-04-04
  • python代码 输入数字使其反向输出的方法

    python代码 输入数字使其反向输出的方法

    今天小编就为大家分享一篇python代码 输入数字使其反向输出的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2018-12-12
  • Python使用Windows API创建窗口示例【基于win32gui模块】

    Python使用Windows API创建窗口示例【基于win32gui模块】

    这篇文章主要介绍了Python使用Windows API创建窗口操作,结合实例形式分析了Python基于win32gui模块调用Windows API创建窗口具体操作步骤与相关实现技巧,需要的朋友可以参考下
    2018-05-05
  • 基于Python编写一个IP地址存活检查器

    基于Python编写一个IP地址存活检查器

    这篇文章主要为大家详细介绍了如何基于Python编写一个IP地址存活检查器,文中的示例代码讲解详细,感兴趣的小伙伴可以了解一下
    2024-11-11
  • python 使用openpyxl读取excel数据

    python 使用openpyxl读取excel数据

    这篇文章主要介绍了python 使用openpyxl读取excel数据的方法,帮助大家更好的理解和学习使用python,感兴趣的朋友可以了解下
    2021-02-02
  • sklearn.metrics 中的f1-score简介

    sklearn.metrics 中的f1-score简介

    这篇文章主要介绍了sklearn.metrics 中的f1-score简介,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2023-05-05

最新评论