Commit 91215375 by BellCodeEditor

save project

parent b22126d9
Showing with 12 additions and 3 deletions
......@@ -3,7 +3,7 @@ from pygame import locals
import os
click=False
path="C:\\Users\\张国耀\\Desktop\\1\\"
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -18,7 +18,7 @@ mlist=os.listdir(r"C:\Users\张国耀\Desktop\1")
a=-1
for file in mlist:
a+=1
if file[-4:] != (".wav",".ogg",".mp3"):
if file[-4:] != ".wav" and file[-4:] != ".ogg" and file[-4:] != ".mp3":
mlist.pop(a)
# 载入音乐
num=-1
......@@ -59,12 +59,21 @@ while True:
pygame.mixer.music.pause()
click=True
if x>120 and x<220 and y<400 and y>350:
if num>0:
num-=1
pygame.mixer.music.load(path+mlist[num])
pygame.mixer.music.play()
elif num==0:
num=len(mlist)-1
pygame.mixer.music.load(path+mlist[num])
pygame.mixer.music.play()
if pygame.mixer.music.get_busy() == False:
if num>len(mlist)-1:
num=0
else:
num+=1
path="C:\\Users\\张国耀\\Desktop\\1\\"
pygame.mixer.music.load(path+mlist[num])
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