Commit 08abd000 by BellCodeEditor

save project

parent 4ee61d67
Showing with 26 additions and 11 deletions
...@@ -69,6 +69,7 @@ while True: ...@@ -69,6 +69,7 @@ while True:
else: else:
click += 1 click += 1
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲 if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1 num -= 1
if num < 0: if num < 0:
...@@ -79,16 +80,11 @@ while True: ...@@ -79,16 +80,11 @@ while True:
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
else: else:
click += 1 click +=1
play_time = pygame.mixer.music.get_pos()
play_time = int(play_time/1000)
play_m = play_time//60
play_s = play_time%60
info = str(play_m) + ':' +str(play_s)
nb = play_time
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
...@@ -97,6 +93,25 @@ while True: ...@@ -97,6 +93,25 @@ 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])
music_length = music1.get_length()
music_length = int(music_length)
play_time = pygame.mixer.music.get_pos()
play_time = int(play_time/1000)
nb = play_time
play_m = play_time//60
play_s = play_time%60
if play_time<10:
play_s="0"+str(play_s)
info = str(play_m) + ':' +str(play_s)
music_m=music_length//60
music_s=music_length%60
if music_s<10:
music_s="0"+music_s
info2 = str(music_m)+':'+str(music_s)
# 绘制画面 # 绘制画面
if play_button == stop_img: if play_button == stop_img:
...@@ -113,6 +128,8 @@ while True: ...@@ -113,6 +128,8 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
scoreSurf = basic_font.render(info,True,(255,255,255)) scoreSurf = basic_font.render(info,True,(255,255,255))
screen.blit(scoreSurf,(120,440)) screen.blit(scoreSurf,(120,440))
scoreSurf2 = basic_font.render('/'+info2,True,(0,0,0))
screen.blit(scoreSurf2,(170,440))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
\ No newline at end of file
KK={'EE'}
KK={'EE'}
\ 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