diff --git a/my_music.py b/my_music.py index aaf1d2c..0819a75 100644 --- a/my_music.py +++ b/my_music.py @@ -6,6 +6,7 @@ pygame.init() # 初始化 # 创建窗口 screen = pygame.display.set_mode((640, 480)) # 载入图片、资源 +FPS=pygame.time.Clock() bg_img = pygame.image.load('background.png') # 背景图 play_img = pygame.image.load('play.png') # 播放按钮 stop_img = pygame.image.load('stop.png') # 暂停按钮 @@ -85,8 +86,12 @@ while True: num = 0 pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.play() - - # 绘制画面 + p_t=pygame.mixer.music.get_pos() + p_t=int(p_t/1000) + p_m=p_t//60 + p_s=p_t%60 + info=str(p_m)+":"+str(p_s) + # 绘制画面\ new_logo=pygame.transform.rotate(logo_img,angle) newrect=new_logo.get_rect(center=(320,200)) pos=(newrect[0],newrect[1]) @@ -96,6 +101,9 @@ while True: screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(new_logo,pos) # 中间logo图 screen.blit(last_img, (120, 350)) # 上一曲 - screen.blit(next_img, (420, 350)) # 下一曲 + screen.blit(next_img, (420, 350)) + scoresurf=basic_font.render(info,True,(255,255,255)) + screen.blit(scoresurf,(120,440)) # 下一曲 # 刷新画面 - pygame.display.update() \ No newline at end of file + pygame.display.update() + \ No newline at end of file