Commit 0c36eb27 by BellCodeEditor

save project

parent 18226243
Showing with 18 additions and 4 deletions
......@@ -13,7 +13,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
basic_font=pygame.font.Font(neuropol.ttf)
basic_font=pygame.font.Font("neuropol.ttf",14)
music_list = []
path = "C:\\Users\\LENOVO\\Desktop\\test"
filelist = os.listdir(path)
......@@ -66,6 +66,10 @@ while True:
click += 2
else:
click += 1
#
music1=pygame.mixer.Sound(path+"//"+music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1
......@@ -78,7 +82,10 @@ while True:
click += 2
else:
click += 1
#
music1=pygame.mixer.Sound(path+"//"+music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
if pygame.mixer.music.get_busy() == False:
num += 1
if num > len(music_list)-1:
......@@ -90,12 +97,16 @@ while True:
nweRect=new_logo.get_rect(center=(320,200))#指定中心点
pos=(nweRect[0],nweRect[1])
angle+=1
#
#进度
play_time=pygame.mixer.music.get_pos()
play_time=int(play_time/1000)
play_m=play_time//60
play_s=play_time%60
info=str(play_m)+":"+str(play_s)
info=str(play_m)+":"+str(play_s)
#
music_m=music_length//60
music_s=music_length%60
info2=str(music_m)+str (music_s)
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
......@@ -104,6 +115,8 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲
scoreSurf=basic_font.render(into,True,(255,255,255))
screen.blit(scoreSurf,(120,440))
scoreSurf2=basic_font.render("/"+info2,True,(0,0,0))
screen.blit(scoreSurf2,(170,440))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ 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