Commit 52cd549e by BellCodeEditor

save project

parent 990d3e87
Showing with 19 additions and 4 deletions
......@@ -14,8 +14,8 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 音乐
music_list = ['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg'] #创建一个空列表
path = "C:\\Users\\Administrator.DESKTOP-HV9S1R8\\Desktop\\text" #桌面创建一个test
music_list = []
path = "C:\\Users\\bellcode\\Desktop\\test"
filelist = os.listdir(path)
for i in filelist:
if i[-4:] == ".ogg" or i[-4:] == ".wav":
......@@ -55,6 +55,22 @@ while True:
else:
play_button = play_img
pygame.mixer.music.pause()
if x > 120 and x < 220 and y > 350 and y < 400: #上一曲
num -= 1
if num < 0:
num = len(music_list) - 1
pygame.mixer.music.load(path +"\\" +music_list[num])
pygame.mixer.music.play()
play_button = stop_img
click = 0
if x > 420 and x < 520 and y > 350 and y < 400: #下一曲
num += 1
if num > len(music_list)-1:
num = 0
pygame.mixer.music.load((path +"\\" +music_list[num])
pygame.mixer.music.play()
play_button = stop_ing
click = 0
if pygame.mixer.music.get_busy() == False:
num += 1
......@@ -71,4 +87,4 @@ while True:
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面
pygame.display.update()
\ No newline at end of file
pygame.display.update()
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