Commit b20d85af by BellCodeEditor

save project

parent c102d18e
Showing with 20 additions and 3 deletions
...@@ -66,18 +66,22 @@ while True: ...@@ -66,18 +66,22 @@ 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 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:
num = len(music_list) - 1 num = len(music_list) - 1
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
if click % 2 == 0: if click % 2 == 0:
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
...@@ -85,14 +89,23 @@ while True: ...@@ -85,14 +89,23 @@ 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= int(music1.get_length())
print(music_length)
play_time=pygame.mixer.music.get_pos() play_time=pygame.mixer.music.get_pos()
play_time=int(play_time/1000) play_time=int(play_time/1000)
# 播放当前长度
play_m=play_time//60 play_m=play_time//60
play_s=play_time%60 play_s=play_time%60
if play_s <10:
play_s="0"+str(play_s)
into=str(play_m)+":"+str(play_s) into=str(play_m)+":"+str(play_s)
# 总长度
music_m=music_length//60
music_s=music_length%60
into2=str(music_m)+":"+str(music_s)
# print(into) # print(into)
text=my_font.render(into,True,(0,0,0))
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])
...@@ -105,6 +118,9 @@ while True: ...@@ -105,6 +118,9 @@ while True:
screen.blit(new_logo, (pos)) # 中间logo图 screen.blit(new_logo, (pos)) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
text=my_font.render(into,True,(0,0,0))
screen.blit(text,(120,420)) screen.blit(text,(120,420))
text2=my_font.render(into2,True,(225,225,225))
screen.blit(text2,(190,420))
# 刷新画面 # 刷新画面
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