From cd30cb288fc6162e7078c508525b8f54fbf3fe2d Mon Sep 17 00:00:00 2001 From: p8hrgqm6a <2069279050@qq.com> Date: Sun, 2 Jun 2024 22:13:25 +0800 Subject: [PATCH] ADD file via upload --- toubu.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 toubu.py diff --git a/toubu.py b/toubu.py new file mode 100644 index 0000000..e5f4917 --- /dev/null +++ b/toubu.py @@ -0,0 +1,52 @@ +import pygame +from tqdm import tqdm +import time +pygame.mixer.init() +# 修改音乐的 file 路径 + +# 循环播放音乐 +file ='s.ogg' +track = pygame.mixer.music.load(file) +pygame.mixer.music.play() +# 初始化 PyGame +pygame.init() + +# 设置屏幕大小 +screen = pygame.display.set_mode((800, 600)) + +# 加载背景图片 +background_image = pygame.image.load('1.webp') + +# 进度条相关变量 +progress = 0 +max_progress = 100 +progress_show = True + + + +# 游戏循环 +running = True +while running: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + + # 绘制背景 + screen.blit(background_image, (0, 0)) + + # 绘制进度条 + pygame.draw.rect(screen, (0, 255, 0), (100, 400, progress * 6, 20)) + # 更新进度 + progress += 1 + if progress > max_progress: + progress_show = False + screen.fill((255, 255, 255)) + import cs.py + + + # 刷新屏幕 + pygame.display.flip() + time.sleep(0.1) + +# 退出 PyGame +pygame.quit() \ No newline at end of file