‘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(‘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, randint
os.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() / 3
if 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 += 0
for 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 pause
if event.button == 3:
pause = not pause
if event.type == KEYDOWN:
if event.key == K_SPACE:
pause = not pause
screen1.fill(bg_rgb)
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Python工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Python开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以扫码获取!!!(备注Python)
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以扫码获取!!!(备注Python)
![img](https://img-blog.csdnimg.cn/img_convert/5a95f0eafbacb5cc7716ab6adcccc8da.jpeg)