Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)「建议收藏」

您所在的位置:网站首页 我很想你的图片文字大全 Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)「建议收藏」

Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)「建议收藏」

2024-07-07 00:36:44| 来源: 网络整理| 查看: 265

大家好,又见面了,我是你们的朋友全栈君。

​  

Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)「建议收藏」Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)「建议收藏」

来源:百度动图

在这里插入图片描述在这里插入图片描述

我发现网上有很多写得很好的Python表白代码,感觉绘出来的图很漂亮。我整理了一下,挑了一些我觉得不错的代码和部分自认不错的原创分享给大家(这些我都测试过,确实可以生成喔~),选一种喜欢的方式发给你的那个她/他吧。

Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)「建议收藏」Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)「建议收藏」1. 一行代码画爱心代码语言:javascript复制print('\n'.join([''.join([('Love'[(x-y)%4]if((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3 5: # 剩余树枝太少要结束递归 if branchLen < 20: # 如果树枝剩余长度较短则变绿 t.color("green") t.pensize(random.uniform((branchLen + 5) / 4 - 2, (branchLen + 6) / 4 + 5)) t.down() t.forward(branchLen) love(t.xcor(), t.ycor()) # 传输现在turtle的坐标 t.up() t.backward(branchLen) t.color("brown") return t.pensize(random.uniform((branchLen + 5) / 4 - 2, (branchLen + 6) / 4 + 5)) t.down() t.forward(branchLen) # 以下递归 ang = random.uniform(15, 45) t.right(ang) tree(branchLen - random.uniform(12, 16), t) # 随机决定减小长度 t.left(2 * ang) tree(branchLen - random.uniform(12, 16), t) # 随机决定减小长度 t.right(ang) t.up() t.backward(branchLen) myWin = turtle.Screen() t = turtle.Turtle() t.hideturtle() t.speed(1000) t.left(90) t.up() t.backward(200) t.down() t.color("brown") t.pensize(32) t.forward(60) tree(100, t) myWin.exitonclick()

效果图

在这里插入图片描述在这里插入图片描述Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)「建议收藏」Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)「建议收藏」1. 星空下的告白代码语言:javascript复制""" 代码用途:表白 作者:阿黎逸阳 """ def bgpic(self, picname=None): """Set background image or return name of current backgroundimage. Optional argument: picname -- a string, name of a gif-file or "nopic". If picname is a filename, set the corresponding image as background. If picname is "nopic", delete backgroundimage, if present. If picname is None, return the filename of the current backgroundimage. Example (for a TurtleScreen instance named screen): >>> screen.bgpic() 'nopic' >>> screen.bgpic("landscape.gif") >>> screen.bgpic() 'landscape.gif' """ if picname is None: return self._bgpicname if picname not in self._bgpics: self._bgpics[picname] = self._image(picname) self._setbgpic(self._bgpic, self._bgpics[picname]) self._bgpicname = picname # coding: utf-8 import pygame import os import sys from pygame.locals import * os.chdir('F:/微信公众号/Python/29.加载音乐') os.getcwd() pygame.init() pygame.mixer.init() pygame.mixer.music.load("告白.mp3") #pygame.mixer.music.set_volume(0.4) pygame.mixer.music.play() bg_size = width, height = 300, 200 bg_rgb = (255, 255, 255) screen1 = pygame.display.set_mode(bg_size) pygame.display.set_caption("告白音乐") clock = pygame.time.Clock() play_image = pygame.image.load("开始和暂停按钮2.png").convert_alpha() pause_image = pygame.image.load("开始和暂停按钮2.png").convert_alpha() pause_rect = pause_image.get_rect() print(pause_rect.width,pause_rect.height) pause_rect.left, pause_rect.top = (width - pause_rect.width) // 2, (height - pause_rect.height) // 2 from turtle import * from random import random,randint os.chdir('F:/微信公众号/Python/0.已发表') screen = Screen() width ,height = 900,700 screen.setup(width,height) screen.title("告白") screen.bgcolor("black") screen.bgpic(r'./星空下互相告白的两个人2.gif') screen.mode("logo") screen.delay(0) printer = Turtle() printer.hideturtle() printer.penup() printer.color('red') printer.goto(-100,-350) printer.write("In the whole universe\n\n",move = True, align="left", font=("Italic", 30, "bold")) printer.goto(-50,-400) printer.write("YZ I only love you!\n\n",move = True, align="left", font=("Italic", 30, "bold")) t = Turtle(visible = False,shape='circle') t.pencolor("white") t.fillcolor("white") t.penup() t.setheading(-90) t.goto(width/2,randint(-height/2,height/2)) stars = [] for i in range(300): star = t.clone() s =random()/3 if s>0.01 and s0.03 and s0.05 and s0.15 and s0.19 and s0.21 and s0.29 and s0.31 and s0.32 and s


【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭