Commit bcdcf89d by BellCodeEditor

save project

parent 08b280fe
Showing with 21 additions and 2 deletions
...@@ -53,6 +53,9 @@ while True: ...@@ -53,6 +53,9 @@ while True:
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
l=pygame.mixer.Sound(path+'\\'+music_list[num])
music_length=l.get_length()
music_length=int(music_length)
if x > 420 and x < 520 and y > 350 and y < 400: # 下一曲 if x > 420 and x < 520 and y > 350 and y < 400: # 下一曲
num += 1 num += 1
if num > len(music_list) - 1: if num > len(music_list) - 1:
...@@ -60,6 +63,9 @@ while True: ...@@ -60,6 +63,9 @@ while True:
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
play_button = stop_img play_button = stop_img
l=pygame.mixer.Sound(path+'\\'+music_list[num])
music_length=l.get_length()
music_length=int(music_length)
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
else: else:
...@@ -72,6 +78,9 @@ while True: ...@@ -72,6 +78,9 @@ while True:
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
play_button = stop_img play_button = stop_img
l=pygame.mixer.Sound(path+'\\'+music_list[num])
music_length=l.get_length()
music_length=int(music_length)
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
else: else:
...@@ -87,7 +96,9 @@ while True: ...@@ -87,7 +96,9 @@ while True:
num = 0 num = 0
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
music1 = pygame.mixer.Sound(path + "//" + music_list[num]) l = pygame.mixer.Sound(path + "//" + music_list[num])
music_length=l.get_length()
music_length=int(music_length)
# 绘制画面 # 绘制画面
...@@ -98,6 +109,11 @@ while True: ...@@ -98,6 +109,11 @@ while True:
if sj_s < 10: if sj_s < 10:
sj_s = "0" + str(sj_s) sj_s = "0" + str(sj_s)
info = str(sj_m) + ":" + str(sj_s) info = str(sj_m) + ":" + str(sj_s)
music_m = music_length//60
music_s = music_length%60
if music_s < 10:
music_s = "0" + str(music_s )
ui= str(music_m) + ":" + str(music_s)
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) screen.blit(play_button, (270, 330))
screen.blit(logo_play,logo_pos) # 暂停按钮 screen.blit(logo_play,logo_pos) # 暂停按钮
...@@ -106,6 +122,8 @@ while True: ...@@ -106,6 +122,8 @@ while True:
screen.blit(next_img, (420, 350)) screen.blit(next_img, (420, 350))
time_content=display_fonts.render(info,True,(255,255,255)) time_content=display_fonts.render(info,True,(255,255,255))
screen.blit(time_content,(120,450)) screen.blit(time_content,(120,450))
# music_content=display_font.render('/'+dis_m) # 下一曲 music_content=display_fonts.render('/'+ui,True,(0,0,0))
screen.blit(music_content,(180,450))
# 下一曲
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
\ No newline at end of file
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