Commit cc0b11a4 by BellCodeEditor

auto save

parent ad5035df
Showing with 21 additions and 2 deletions
......@@ -22,7 +22,7 @@ angle = 0
for i in filelist:
if i[-4:] == ".wav" or i[-4:] == ".ogg":
music_list.append(i)
volume = 0.2
volume = 0.5
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
......@@ -86,13 +86,29 @@ while True:
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
music1 = pygame.mixer.Sound(path + "\\" + music_list[num])
print(music1)
music_lenght = music1.get_lenght()
music_lenght = int(music_lenght)
#歌曲播放进度时间
play_time = pygame.mixer.music.get_pos()
play_time = int(play_time/1000)
play_m = play_time // 60 #分钟
play_s = play_time % 60 #秒
if play_s < 10:
play_s = "0" + str(play_s)
info = str(play_m) + ":" +str(play_s)
#歌曲的时间长度
music_m = music_lenght // 60
music_s = music_lenght % 60
if music_s < 10 :
music_s = "0" +str(music_s)
info2 = str(music_m) + ":" + str(music_s)
#旋转logo图片
new_logo = pygame.transform.rotate(logo_img,angle)
......@@ -109,6 +125,8 @@ while True:
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
scoreSurf = basic_font.render(info,True,(255,255,255))
screen.blit(scoreSurf,(120,440))
scoreSurf2 = basic_font.render("/" + info2,Ture,(0,0,0))
screen.blit(scoreSurf2,(170,440))
# 刷新画面
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