Commit f4bb3f8e by BellCodeEditor

save project

parent 666d0cbf
Showing with 15 additions and 4 deletions
...@@ -12,7 +12,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮 ...@@ -12,7 +12,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮 last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮 next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮 logo_img = pygame.image.load('logo.png') # 下一曲按钮
my_font = pygame.font.Font("neuropol.ttf",18)
music_list = [] music_list = []
path = "C:\\Users\\EDZ\\Desktop\\test" path = "C:\\Users\\EDZ\\Desktop\\test"
filelist = os.listdir(path) filelist = os.listdir(path)
...@@ -83,11 +83,19 @@ while True: ...@@ -83,11 +83,19 @@ 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 = 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
info=str(play_m)+":"+str(play_s) info1=str(play_m)+":"+str(play_s)
play_m = music_length // 60
play_s = music_length % 60
if play_s < 10:
play_s = "0"+str(play_s)
info2 = str(play_m)+":"+str(play_s)
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])
...@@ -100,5 +108,8 @@ while True: ...@@ -100,5 +108,8 @@ 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)) # 下一曲
# 刷新画面 # 刷新画面
text1 = my_font.render(info1,True,(225,250,215))
screen.blit(text1,(120,440))
text2 = my_font.render("/"+info2,True,(0,0,0))
pygame.display.update() pygame.display.update()
print(info) screen.blit(text2,(180,440))
\ No newline at end of file \ 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