Commit 3df4ed68 by BellCodeEditor

save project

parent 4a10bbab
Showing with 13 additions and 8 deletions
...@@ -63,7 +63,7 @@ while True: ...@@ -63,7 +63,7 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music=pygame.mixer.sound(path + "\\" + music_list[num]) music=pygame.mixer.Sound(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
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
...@@ -78,20 +78,24 @@ while True: ...@@ -78,20 +78,24 @@ while True:
click += 1 click += 1
music=pygame.mixer.Sound(path + "\\" + music_list[num]) music=pygame.mixer.Sound(path + "\\" + music_list[num])
pygame.mixer.music.play() 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(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()
play_time=pygame.mixer.music.get_pos()
play_time=int(play_time/1000)
music=pygame.mixer.Sound(path + "\\" + music_list[num]) music=pygame.mixer.Sound(path + "\\" + music_list[num])
music_len=music.get_length() music_len=music.get_length()
pygame.mixer.music.play() pygame.mixer.music.play()
play_time1=pygame.mixer.music.get_pos()
print(play_time1)
play_time1=int(play_time1/1000)
music_len=int(music_len) music_len=int(music_len)
play_m=play_time//60 play_m=play_time1//60
play_s=play_time%60 play_s=play_time1%60
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)
...@@ -99,14 +103,14 @@ while True: ...@@ -99,14 +103,14 @@ while True:
music_lens=music_len%60 music_lens=music_len%60
if music_lens<10: if music_lens<10:
music_lens="0"+str(music_lens) music_lens="0"+str(music_lens)
info1=str(music_lenm)+":"+str(music_lens) info1="/"+str(music_lenm)+":"+str(music_lens)
new_logo=pygame.transform.rotate(logo_img,d) new_logo=pygame.transform.rotate(logo_img,d)
newRect=new_logo.get_rect(center=(320,200)) newRect=new_logo.get_rect(center=(320,200))
pot=(newRect[0],newRect[1]) pot=(newRect[0],newRect[1])
if play_button== stop_img: if play_button== stop_img:
d+=1 d+=1
text = my_font.render(info,True,(255,255,255)) text = my_font.render(info,True,(255,255,255))
text1= my_font.render(info,True,(0,0,0)) text1= my_font.render(info1,True,(0,0,0))
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(play_button, (270, 330)) # 暂停按钮
...@@ -114,6 +118,6 @@ while True: ...@@ -114,6 +118,6 @@ while True:
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
screen.blit(text,(120,440)) screen.blit(text,(120,440))
screen.blit(text1,(170,440)) screen.blit(text1,(190,440))
# 刷新画面 # 刷新画面
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