Commit bc0f1491 by BellCodeEditor

save project

parent af39b7e2
Showing with 23 additions and 10 deletions
...@@ -24,6 +24,9 @@ p=os.listdir("C:\\桌面\\txt") ...@@ -24,6 +24,9 @@ p=os.listdir("C:\\桌面\\txt")
num=-1 num=-1
while True: while True:
for i in p:
if i[-4:]== ".mp3":
p.append(i)
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
...@@ -52,20 +55,30 @@ while True: ...@@ -52,20 +55,30 @@ while True:
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() # 次数增加 pygame.mixer.music.pause() # 次数增加
if x>120 and x<220 and y>350 and y<400:
num-=1
if num==-1:
num=len(p)-1
click=0
if click % 2 == 0:
play_button = stop_img
pygame.mixer.music.load("C:\\桌面\\txt"+"\\"+p[num])
pygame.mixer.music.play()
if 400 and x<500 and y>350 and y<400:
num+=1
click=0
if num==len(p):
num=0
if click % 2 == 0:
play_button = stop_img
pygame.mixer.music.load("C:\\桌面\\txt"+"\\"+p[num])
pygame.mixer.music.play()
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num+=1 num+=1
if num>len(p)-1: if num>len(p)-1:
num=0 num=0
pygame.mixer.music.load(p[num]) pygame.mixer.music.load("C:\\桌面\\txt"+"\\"+p[num])
pygame.mixer.music.play() pygame.mixer.music.play() # 下一曲
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(logo_img, (170, 60)) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
pygame.display.update() 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