Commit 2a4abfc6 by BellCodeEditor

save project

parent 849e3cf2
Showing with 11 additions and 4 deletions
...@@ -18,15 +18,18 @@ pygame.mixer.music.load('歌曲2.wav') ...@@ -18,15 +18,18 @@ pygame.mixer.music.load('歌曲2.wav')
pygame.mixer.music.load('歌曲3.wav') pygame.mixer.music.load('歌曲3.wav')
volume = 0.2 volume = 0.2
asdf=["歌曲4.ogg","歌曲1.wav","歌曲2.wav","歌曲3.wav"] asdf=[]
pygame.mixer.music.set_volume(volume) # 初始播放音量 pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0 click = 0
play_button = stop_img play_button = stop_img
path="C:\\Users\\Administrator\\Desktop" path=r"C:\Users\Administrator\Desktop\test"
fil=os.listdir(path) fil=os.listdir(path)
print(fil)
num = -1
for i in fil: for i in fil:
if i[-4]=="wav" or i[-4] == "ogg": if i[-4:]==".wav" or i[-4:] == ".ogg":
asdf.append(i) asdf.append(i)
print(asdf)
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -57,6 +60,10 @@ while True: ...@@ -57,6 +60,10 @@ while True:
pygame.mixer.music.pause() pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num +=1
if num > len(asdf)-1:
num=0
pygame.mixer.music.load(path+"\\"+asdf[num])
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