目录

1 前言

2 霍金说移民外太空

3 浪漫的流星雨展示

4 Python代码


1 前言

我们先给个小故事,提一下大家兴趣;然后我给出论据,得出结论。最后再浪漫的流星雨表白代码奉上,还有我自创的一首诗。开始啦:

2 霍金说移民外太空

霍金说我们将来外星上生存;埃隆.马斯克也是这样想的。

我前面讲外星人来不到地球,这个道理已经很清楚。我再说几个数据,大家听听,我们且不要说到更远的外星,我们人类今天登上月球,把一个字航员送上月球,他在月球上待一分钟,要消耗地球一百万美元的资源才能在月球上待一分钟 。

我们说未来在火星上殖民,想想你在月球上一个人待一分钟,要消耗地球一百万美元的资源,你在火星上殖民几千人、几万人,你得把整个地球资源毁灭掉,都调到火星上去。然后你只把七十亿人调过去了几千、几万人,然后他在那可能死得更快,这根本不是出路,这怎么会成为出路呢?

我们再看,移居外星,离我们地球最近的另一个恒星系叫半人马座。半人马座,阿尔法星

也叫比邻星。大家注意,这都是恒星,比邻星距离太阳最近,有多近?  4.2光年,光以每秒钟三十万公里,走4.2年,就这我们还不知道比邻星的那个恒星旁边有没有行星。

就算有行星有没有宜居行星、类地行星。这我们还全然不知道。我们就假定那个地方有好了另一个地球,你按照今天人类火箭和卫星的最高速度,你单程从地球上飞到比邻星,需要一万五千年到三万年。

请注意我们文明史,文明有文字,以后的文明迄今才五千年,你单程飞到那个地方要一万五千年以上。我说过有没有行星都不知道。这个前途存在吗?根本不存在。就像外星人来不了我们这儿一样,我们也到不了任何外星存在。

我们今天连太阳系都没有走出去,没有在太阳系的任何一个行星上殖民,所以移民外星根本不是出路。

3 浪漫的流星雨展示

浪漫的流星雨

4 Python代码


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._bgpicnameif 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('E:/星空下的告白')
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()
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, randintos.chdir('E:星空下的告白')
screen = Screen()
width, height = 900, 700
screen.setup(width, height)
screen.title("浪漫的流星雨")
screen.bgcolor("black")
screen.mode("logo")
screen.delay(0)
printer = Turtle()
printer.hideturtle()
printer.penup()
printer.color('red')
printer.goto(-100, -350)
printer.write("宇宙广阔(弱水三千)""\n\n", move=True, align="left", font=("Italic", 30, "bold"))
printer.goto(-50, -400)
printer.write("只寻你一颗!(只取一瓢饮!)\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() / 3if s > 0.01 and s < 0.03:star.pencolor("black")star.fillcolor("black")elif s > 0.03 and s < 0.04:star.pencolor("lightcoral")star.fillcolor("lightcoral")elif s > 0.05 and s < 0.1:star.pencolor("green")star.fillcolor("green")elif s > 0.15 and s < 0.16:star.pencolor("yellow")star.fillcolor("yellow")elif s > 0.19 and s < 0.2:star.pencolor("red")star.fillcolor("red")elif s > 0.21 and s < 0.22:star.pencolor("purple")star.fillcolor("purple")elif s > 0.29 and s < 0.3:star.pencolor("darkorange")star.fillcolor("darkorange")elif s > 0.31 and s < 0.32:star.pencolor("red")star.fillcolor("yellow")elif s > 0.32 and s < 0.33:star.pencolor("yellow")star.fillcolor("white")star.shapesize(s, s)star.speed(int(s * 30))star.setx(width / 2 + randint(1, width))star.sety(randint(-height / 2, height / 2))# star.showturtle()stars.append(star)
i = 0
pause = False
while True:i += 0for star in stars:star.setx(star.xcor() - 3 * star.speed())if star.xcor() < -width / 2:star.hideturtle()star.setx(width / 2 + randint(1, width))star.sety(randint(-height / 2, height / 2))star.showturtle()if i >= 100:break# 查找队列事件for event in pygame.event.get():# 查找点击关闭窗口事件if event.type == QUIT:sys.exit# 查找鼠标左右击事件if event.type == MOUSEBUTTONDOWN:if event.button == 1:pause = not pauseif event.button == 3:pause = not pauseif event.type == KEYDOWN:if event.key == K_SPACE:pause = not pausescreen1.fill(bg_rgb)if pause:pygame.mixer.music.pause()screen1.blit(pause_image, pause_rect)else:pygame.mixer.music.unpause()screen1.blit(play_image, pause_rect)pygame.display.flip()clock.tick(30)

你值得拥有——流星雨下的告白(Python实现)相关推荐

  1. Python浪漫表白源码合集(爱心、玫瑰花、照片墙、星空下的告白)

    ​   来源:百度动图 我发现网上有很多写得很好的Python表白代码,感觉绘出来的图很漂亮.我整理了一下,挑了一些我觉得不错的代码和部分自认不错的原创分享给大家(这些我都测试过,确实可以生成喔~), ...

  2. 【Python表白代码】你喜欢什么场景下的告白?“我途径一场樱花的绽放 想分享给你”(永不落幕的樱花代码合集)

    导语 秒速五厘米,那是樱花飘落的速度,那么,怎样的速度,才能走完我与你之间的距离?                                                           ...

  3. 适合win7的python版本_windows下多个python版本共存,如何在Windows7系统上安装最新的64位Python3.6.2...

    windows下多个python版本共存,如何在Windows7系统上安装最新的64位Python3.6.2 1.官网下载python3.6.2 https://www.python.org/ftp/ ...

  4. 下划线在 Python 中的特殊含义

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 Python 中的下划线 下划线在 Python 中是有特殊含义的 ...

  5. CentOS6.5_64下 nginx+uwsgi+Python +多站点环境搭建

    本文章为各位介绍一篇关于CentOS6.5_64下 nginx+uwsgi+Python +多站点环境搭建 python web django 框架的例子. 作为一个严谨(其实就是有强迫症)的程序,为 ...

  6. python查找文件夹下的文件,python 查找文件夹下所有文件 实现代码 -电脑资料

    复制代码代码如下: def find_file_by_pattern(pattern='.*', base=".", circle=True): '''''查找给定文件夹下面所有 ...

  7. python怎么安装pandas模块-windows下如何安装Python、pandas

    windows下如何安装Python.pandas 本篇主要涵盖以下三部分内容: Python.Pycharm的安装 使用Pycharm创建.运行Python程序 安装pandas 1.Python. ...

  8. python下载教程win10-win10系统下如何安装Python软件

    Python是一门受广大用户所喜爱欢迎的.使用广泛的语言.最近,就有一些升级win10系统的用户反映自己想要在新系统中安装Python软件,但是又不知道该如何操作.接下来,小编就为大家分享win10系 ...

  9. Mac下如何查看Python的版本?

    转载自:http://www.zhengjie.info/2012/01/20/2787 Mac下如何查看Python的版本? 问题:Mac下如何查看Python的版本? 系统:Mac OS X 软件 ...

  10. python命令提示符窗口在哪里_详解python命令提示符窗口下如何运行python脚本

    以arcgispro的python脚本为例在arcgispro自带的python窗口下运行python脚本 需求: 将arcgispro的.aprx项目包中gdb的数据源路径更换为sde数据源路径. ...

最新文章

  1. python求偏导_python实现点位精度评定
  2. 前端学习(2854):简单秒杀系统学习之settimeout
  3. php mvc urlencode,PHP – LIUGUOFENG
  4. 机器学习、神经网络中不懂的函数及功能实现
  5. PPT文件如何大幅度瘦身、减小所占空间、提高播放速度?
  6. (转)策略回测的框架、实现、测试
  7. Nginx为什么会比Apache Httpd高效
  8. API Monitor简介(API监控工具)
  9. 儿童机器人编程语言_机器人十大流行编程语言的介绍
  10. uygurqa输入法android,uygurqaapp输入法
  11. 大胜凭德--入行选领导(转载分析)
  12. uview Cell 单元格 右侧箭头偏小
  13. 电动汽车连接器的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告
  14. CppPrimer 学习笔记(1)
  15. 美多商城之商品(2)
  16. 9种圣诞字体tabs选择
  17. 2022年安全员-A证考题及在线模拟考试
  18. 创宇区块链 | 黑客利用重入漏洞盗币,Ola_finance 攻击事件分析
  19. auc指标含义的理解
  20. MySQL实现自增的序列(Sequence)

热门文章

  1. 星界边境机器人升级,星界边境作弊码分享
  2. Linux常用操作命令(乌班图)
  3. D语言使用dub编译ms-coff文件
  4. dub报invalid semver
  5. 集体的智慧:为什么SaaS打败企业软件?
  6. 快捷搭建kubeEdge集群
  7. 一个正经的电商运营每天应该看哪些数据?
  8. 免费福利 Unity3D 项目资源分享链接(消消乐、斗地主、AR等)
  9. 2022辽宁最新消防设施操作员模拟试题题库及答案
  10. javascript综合