Commit df6d0b27 by BellCodeEditor

save project

parent 2fc8c3fd
Showing with 18 additions and 1 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') # 下一曲按钮
basic_font=pygame.font.Font('neuropol.ttf',14)
music_list = [] music_list = []
path = "d:\\Desktop\\test" path = "d:\\Desktop\\test"
filelist = os.listdir(path) filelist = os.listdir(path)
...@@ -84,6 +84,9 @@ while True: ...@@ -84,6 +84,9 @@ 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)
# +++++++++++++++++++++++++++++++++++++ # +++++++++++++++++++++++++++++++++++++
new_logo = pygame.transform.rotate(logo_img, angle) new_logo = pygame.transform.rotate(logo_img, angle)
...@@ -92,6 +95,14 @@ while True: ...@@ -92,6 +95,14 @@ while True:
if click%2==0: if click%2==0:
angle += 1 angle += 1
# +++++++++++++++++++++++++++++++++++++ # +++++++++++++++++++++++++++++++++++++
playTime=pygame.mixer.music.get_pos()
playTime=int(playTime/1000)
playm=playTime//60
plays=playTime%60
lengthm=music_length//60
lengths=music_length%60
info=str(playm)+":"+str(plays)
info2='/'+str(lengthm)+":"+str(lengths)
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(play_button, (270, 330)) # 暂停按钮
...@@ -99,4 +110,9 @@ while True: ...@@ -99,4 +110,9 @@ 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)) # 下一曲
# 刷新画面 # 刷新画面
scoreSurf=basic_font.render(info,True,(255,255,255))
screen.blit(scoreSurf,(120,440))
scoreSurf=basic_font.render(info2,True,(255,255,255))
screen.blit(scoreSurf,(170,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