Commit 03d133e6 by BellCodeEditor

save project

parent ca6cc716
Showing with 19 additions and 2 deletions
...@@ -14,6 +14,7 @@ next_img = pygame.image.load('next.png') # 下一曲按钮 ...@@ -14,6 +14,7 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮 logo_img = pygame.image.load('logo.png') # 下一曲按钮
angle =0 angle =0
ziti = pygame.font.Font("neuropol.ttf",24)
music_list = [] music_list = []
path = "C:\\Users\\Administrator\\Desktop\\新建文件夹 (2)" path = "C:\\Users\\Administrator\\Desktop\\新建文件夹 (2)"
filelist = os.listdir(path) filelist = os.listdir(path)
...@@ -67,6 +68,9 @@ while True: ...@@ -67,6 +68,9 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1 = pygame.mixer.Sound(path + "\\" + music_list[num])
legth = music1.get_legth()
legth = int(legth)
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
...@@ -79,6 +83,9 @@ while True: ...@@ -79,6 +83,9 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1 = pygame.mixer.Sound(path + "\\" + music_list[num])
legth = music1.get_legth()
legth = int(legth)
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
...@@ -92,14 +99,20 @@ while True: ...@@ -92,14 +99,20 @@ while True:
pos=(b[0],b[1]) pos=(b[0],b[1])
if play_button==stop_img: if play_button==stop_img:
angle +=0.5 angle +=0.5
#歌曲时长
music1 = pygame.mixer.Sound(path + "\\" + music_list[num])
legth = music1.get_length()
legth = int(legth)
#时长 #时长
Mtime=pygame.mixer_music.get_pos() Mtime=pygame.mixer_music.get_pos()
Mtime=int(Mtime/1000) Mtime=int(Mtime/1000)
Mm=Mtime//60 Mm=Mtime//60
Ms=Mtime%60 Ms=Mtime%60
info=str(Mm)+":"+str(Ms) if Ms<10:
print(info) Ms="0"+str(Ms)
info=str(Mm)+":"+str(Ms)
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
...@@ -107,5 +120,8 @@ while True: ...@@ -107,5 +120,8 @@ while True:
screen.blit(a, pos) # 中间logo图 screen.blit(a, 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)) # 下一曲
#播放时长显示
bfsc=ziti.render(info,True,(0,0,0))
screen.blit(bfsc,(100, 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