Commit 7468d531 by BellCodeEditor

save project

parent bd1730a9
Showing with 25 additions and 3 deletions
......@@ -15,14 +15,15 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo
#list=['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg']
list=[]
path ='C:\\Users\\Administrator\\Desktop\\test'
music_list=os.listdir(path)
for i in music_list:
if i[-4:]=='wav' or i[-4:]=='ogg':
if i[-4:]=='.wav' or i[-4:]=='.ogg':
list.append(i)
num=-1
play_button=stop_img
click=0
volume=0.5
......@@ -59,11 +60,32 @@ while True:
play_button=play_img
time.sleep(0.2)
pygame.mixer.music.pause()
if x> 120 and x<220 and y>350 and y<400:
num-=1
if num<0:
num =len(list)-1
pygame.mixer.music.load(path+'\\'+list[num])
pygame.mixer.music.play()
play_button=stop_img
click=0
time.sleep(0.2)
if x> 420 and x<520 and y>350 and y<400:
num +=1
if num>len(list)-1:
num =0
pygame.mixer.music.load(path+'\\'+list[num])
pygame.mixer.music.play()
play_button=stop_img
click=0
time.sleep(0.2)
if pygame.mixer.music.get_busy()==False:
num+=1
if num>len(music_list)-1:
num=0
pygame.mixer.music.load("歌曲1.wav")
pygame.mixer.music.load(path+'\\'+list[num])
pygame.mixer.music.play()
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
......
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