Commit 4128044d by BellCodeEditor

save project

parent 426554cd
Showing with 9 additions and 4 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import os
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
...@@ -14,8 +14,13 @@ logo_img = pygame.image.load('logo.png') # 中间logo ...@@ -14,8 +14,13 @@ logo_img = pygame.image.load('logo.png') # 中间logo
s=0.55 s=0.55
click=0 click=0
f=0 f=-1
m=['歌曲一.wav','歌曲二.wav','歌曲三.wav','歌曲四.ogg','test.wav'] m=[]
s="C:\\Users\\5\\Desktop\\test"
c=os.listdir(s)
for i in c:
if c[-4:]=='.wav' or c[-4:]=='.ogg':
m.append(i)
k=stop_img k=stop_img
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -51,7 +56,7 @@ while True: ...@@ -51,7 +56,7 @@ while True:
f+=1 f+=1
if f>len(m)-1: if f>len(m)-1:
f=0 f=0
pygame.mixer.music.load(m[f]) pygame.mixer.music.load(s+ '\\'+m[f])
pygame.mixer.music.play() pygame.mixer.music.play()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment