当前位置 : 主页 > 编程语言 > python >

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含

来源:互联网 收集:自由互联 发布时间:2022-06-15
导语 “ 全世界只有不到0.1%的人关注了木木子 你真是个特别的人 ——顾木子吖 ” ☀☀☀☀☀☀☀☀ 每天早上九点 请记得打开手机,查收我的礼物???? 哈喽哈喽~我是木木子—— 之前的


导语


【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_爱心表白

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_turtle_02

“ 全世界只有不到0.1%的人关注了木木子

  你真是个特别的人                                                         ——顾木子吖    ”

☀☀☀☀☀☀☀☀

每天早上九点

请记得打开手机,查收我的礼物????

哈喽哈喽~我是木木子——

之前的表白合集出了效果都挺好的啦~看来大家都喜欢这些简单的小案例。

绘制出来都超好看的Turtle界面啦,今天继续上一期的系列。

出一期全是爱心的文章满足大家的要求啦~

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_python_03

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_表白_04

正文

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_表白文案_05【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_表白文案_05【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_表白文案_05

“ 总 会 有 人 给 你一一温࿐暖࿐的࿐光࿐。”

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_表白文案_08

一、低配版

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_爱心表白_09

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_turtle_10

1)附部分代码

import turtle
import time

#1-2画心形圆弧
def hart_arc():
for i in range(200):
turtle.right(1)
turtle.forward(2)


def move_pen_position(x, y):
turtle.hideturtle() # 隐藏画笔(先)
turtle.up() # 提笔
turtle.goto(x, y) # 移动画笔到指定起始坐标(窗口中心为0,0)
turtle.down() # 下笔
turtle.showturtle() # 显示画笔


love = "听闻小姐治家有方,鄙人余生愿闻其详?" #input("请输入表白话语:")
signature = "先生" #input("请签署你的名字:")
date= "" #input("请写上日期:")

if love == '':
love = 'I Love You'

#1-3初始化
turtle.setup(width=800, height=500) # 窗口(画布)大小
turtle.color('black', 'Pink') # 画笔颜色
turtle.pensize(5) # 画笔粗细
turtle.speed(100) # 描绘速度
# 初始化画笔起始坐标
move_pen_position(x=0, y=-180) # 移动画笔位
turtle.left(140) # 向左旋转140度

turtle.begin_fill() # 标记背景填充位置

#1-4画图和展示
turtle.forward(224) # 向前移动画笔,长度为224
# 画爱心圆弧
hart_arc() # 左侧圆弧
turtle.left(120) # 调整画笔角度
hart_arc() # 右侧圆弧
# 画心形直线( 右下方 )
turtle.forward(224)

turtle.end_fill() # 标记背景填充结束位置

move_pen_position(x=70, y=160) # 移动画笔位置
turtle.left(185) # 向左旋转180度
turtle.circle(-110,185) # 右侧圆弧
# 画心形直线( 右下方 )
#turtle.left(20) # 向左旋转180度
turtle.forward(50)
move_pen_position(x=-180, y=-180) # 移动画笔位置
turtle.left(180) # 向左旋转140度

# 画心形直线( 左下方 )
turtle.forward(600) # 向前移动画笔,长度为224

# 在心形中写上表白话语
move_pen_position(0,50) # 表白语位置
turtle.hideturtle() # 隐藏画笔
turtle.color('#CD5C5C', 'pink') # 字体颜色
# font:设定字体、尺寸(电脑下存在的字体都可设置) align:中心对齐
turtle.write(love, font=('Arial', 20, 'bold'), align="center")

# 签写署名和日期
if (signature != '') & (date != ''):
turtle.color('red', 'pink')
time.sleep(2)
move_pen_position(220, -180)
turtle.hideturtle() # 隐藏画笔
turtle.write(signature, font=('Arial', 20), align="center")
move_pen_position(220, -220)
turtle.hideturtle() # 隐藏画笔
turtle.write(date, font=('Arial', 20), align="center")

#1-5点击窗口关闭程序
window = turtle.Screen()
window.exitonclick()

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_python_11

二、进阶版

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_表白文案_12


【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_turtle_13

​三、高级版

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_表白_14

1)附部分代码

import turtle as t
import math as mt

if __name__ == "__main__":
t.screensize(800,600,'white')
t.pensize(10)
t.speed(10)
#爱心1
t.color('black','pink')
t.begin_fill()
for i in range(-90,90,5):
x=mt.cos(mt.radians(i))
y=float(pow(mt.cos(mt.radians(i)),2/3))+float(mt.sin(mt.radians(i)))
t.penup()
# print(int(x*50)+10,int(y*50)+10)
t.goto(int(x*50)+50,int(y*50)+30)
t.pendown()
t.forward(1)
t.penup()
t.goto(-int(x*50)+50,int(y*50)+30)
t.pendown()
t.forward(1)
t.penup()
t.end_fill()
#爱心2
t.goto(0,10)
t.penup()
t.begin_fill()
for i in range(0,360,5):
r=60*(1-mt.sin(mt.radians(i)))
t.penup()
t.left(5)
t.forward(r)
t.pendown()
t.forward(1)
t.penup()
t.backward(r+1)
t.pendown()
t.end_fill()
#L
t.penup()
t.goto(-200,0)
t.left(90)
t.begin_fill()
t.pendown()
t.forward(100)
t.right(90)
t.forward(20)
t.right(90)
t.forward(80)
t.left(90)
t.forward(40)
t.right(90)
t.forward(20)
t.right(90)
t.forward(60)
t.end_fill()
#o
t.penup()
t.goto(-80,0)
t.pendown()
t.begin_fill()
t.circle(-50)
t.end_fill()
t.penup()
t.color('pink','black')
t.begin_fill()
t.goto(-80,20)
t.pendown()
t.circle(-30)
t.end_fill()
t.color('black','pink')
#E
t.penup()
t.goto(120, 0)
t.right(180)
t.left(90)
t.begin_fill()
t.pendown()
t.forward(100)#上
t.right(90)
t.forward(60)#横
t.right(90)
t.forward(20)#竖
t.right(90)
t.forward(40)#横
t.left(90)
t.forward(20)#竖
t.left(90)
t.forward(40)#横
t.right(90)
t.forward(20)
t.right(90)
t.forward(40)
t.left(90)
t.forward(20)
t.left(90)
t.forward(40)
t.right(90)
t.forward(20)
t.right(90)
t.forward(60)
t.end_fill()

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_python_15

四、衍生版

【表白系列】打扰一下,我有很多话要告诉你:“因为喜欢,可迎万难”(内含多份源码)_turtle_16

总结

好啦好啦~爱心合集????写到这里就完美结束——大家有喜欢的直接找我拿源码的啦

“ 窗户里的风景~

午后的阳光最令人心动 ꀿªᵖᵖᵞ ꔛ♡ “

????完整的免费源码领取处:找我吖!文末公众号可得自行领取,滴滴我也可!




网友评论