Commit 96e5e6ff by BellCodeEditor

save project

parent 539aef6f
Showing with 15 additions and 3 deletions
...@@ -46,6 +46,9 @@ while True: ...@@ -46,6 +46,9 @@ while True:
if event.button == 1: # 左击 if event.button == 1: # 左击
x, y = event.pos x, y = event.pos
if x > 270 and x < 370 and y > 350 and y < 450: # 播放按钮 if x > 270 and x < 370 and y > 350 and y < 450: # 播放按钮
music1=pygame.mixer.sound(path+"\\"+music_list[num])
music_length=music1.gat_lenght()
music_length =int(music_length)
click += 1 click += 1
if click % 2 == 0: if click % 2 == 0:
play_button = stop_img play_button = stop_img
...@@ -53,7 +56,10 @@ while True: ...@@ -53,7 +56,10 @@ while True:
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
if x > 420 and x < 520 and y > 350 and y < 400: # 下一曲 if x > 420 and x < 520 and y > 350 and y < 400:
music1=pygame.mixer.sound(path+"\\"+music_list[num])
music_length=music1.gat_lenght()
music_length =int(music_length) # 下一曲
num += 1 num += 1
if num > len(music_list) - 1: if num > len(music_list) - 1:
num = 0 num = 0
...@@ -90,8 +96,8 @@ while True: ...@@ -90,8 +96,8 @@ while True:
angle+=1 angle+=1
play_time=pygame.mixer.music.get_pos() play_time=pygame.mixer.music.get_pos()
play_time=int(play_img/1000) play_time=int(play_img/1000)
play_m=play_time//60 play_m=play_lenght//60
play_s=play_time%60 play_s=play_lenght%60
info=str(play_m)+":"+str(play_s) info=str(play_m)+":"+str(play_s)
# 绘制画面 # 绘制画面
...@@ -99,7 +105,13 @@ while True: ...@@ -99,7 +105,13 @@ while True:
screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(logo_img, (170, 60)) # 中间logo图 screen.blit(logo_img, (170, 60)) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
music1=pygame.mixer.sound(path+"\\"+music_list[num])
music_length=music1.gat_lenght()
music_length =int(music_length)
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
music1=pygame.mixer.sound(path+"\\"+music_list[num])
music_length=music1.gat_lenght()
music_length =int(music_length)
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