Commit e734a664 by BellCodeEditor

save project

parent b4805f81
Showing with 20 additions and 2 deletions
...@@ -59,6 +59,8 @@ while True: ...@@ -59,6 +59,8 @@ while True:
num += 1 num += 1
if num > len(music_list) - 1: if num > len(music_list) - 1:
num = 0 num = 0
music1 = pygame.mixer.Sound(path+'\\'+music_list[num])
music_length = int(music1,get_length())
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
...@@ -66,7 +68,6 @@ while True: ...@@ -66,7 +68,6 @@ while True:
click += 2 click += 2
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:
...@@ -78,13 +79,16 @@ while True: ...@@ -78,13 +79,16 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1 = pygame.mixer.Sound(path+'\\'+music_list[num])
music_length = int(music1,get_length())
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
if num > len(music_list)-1: if num > len(music_list)-1:
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 = int(music1.get_length())
new_logo = pygame.transform.rotate(logo_img,angle) new_logo = pygame.transform.rotate(logo_img,angle)
newRect = new_logo.get_rect(center = (320,200)) newRect = new_logo.get_rect(center = (320,200))
pos = (newRect[0],newRect[1]) pos = (newRect[0],newRect[1])
...@@ -97,6 +101,13 @@ while True: ...@@ -97,6 +101,13 @@ while True:
if play_s<10: if play_s<10:
play_s = '0'+str(play_s) play_s = '0'+str(play_s)
info = str(play_m)+':'+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'+str(music_s)
info2 = 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)) # 暂停按钮
...@@ -106,5 +117,11 @@ while True: ...@@ -106,5 +117,11 @@ while True:
# 刷新画面 # 刷新画面
play_time = font.render(info,True,(255,255,255)) play_time = font.render(info,True,(255,255,255))
screen.blit(play_time,(120,440)) screen.blit(play_time,(120,440))
play_time = font.render(info,True,(0,0,0))
screen.blit(play_time,(190,440))
music1 = pygame.mixer.Sound(path+'\\'+music_list[num])
music_length = int(music1.get_length())
pygame.display.update() pygame.display.update()
fps.tick(60) fps.tick(60)
\ 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