Commit 48246c90 by BellCodeEditor

save project

parent 3bfd7f06
Showing with 8 additions and 2 deletions
...@@ -15,7 +15,13 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮 ...@@ -15,7 +15,13 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐 # 载入音乐
filelist = ['歌曲1.wav','歌曲1.wav','歌曲1.wav','歌曲1.wav'] filelist = ['歌曲1.wav','歌曲1.wav','歌曲1.wav','歌曲1.wav']
num = -1 num = -1
music_list = []
path = ""
filelist = os.listdir(path)
for i in filelist:
if i[-4:] == ".ogg" op i[-4:] == ".wav":
music_list.append((i))
num = -1
pygame.mixer.music.load('歌曲1.wav') pygame.mixer.music.load('歌曲1.wav')
volume = 0.2 volume = 0.2
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
...@@ -56,7 +62,7 @@ while True: ...@@ -56,7 +62,7 @@ while True:
mun += 1 mun += 1
if num > len(filelist)-1: if num > len(filelist)-1:
num = 0 num = 0
pygame.mixer.music.load(filelist[num]) pygame.mixer.music.load(path + "\\"+music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
......
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