Commit 76445293 by BellCodeEditor

save project

parent 078d96f0
Showing with 19 additions and 4 deletions
......@@ -14,7 +14,7 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
b_f=pygame.font.Font('neuropol.ttf',14)
music_list = []
path = "C:\\Users\\Administrator\\Desktop\\test"
path = "C:\\Users\\Administrator\\Desktop\\text"
filelist = os.listdir(path)
num = -1
angle=0
......@@ -25,7 +25,7 @@ volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
music_length=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -65,7 +65,9 @@ while True:
click += 2
else:
click += 1
music1=pygame.mixer.Sound(path+'\\'+music_list[num])
music_length=music1.get_length()
music_length=len(music_length)
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1
if num < 0:
......@@ -77,7 +79,9 @@ while True:
click += 2
else:
click += 1
music1=pygame.mixer.Sound(path+'\\'+music_list[num])
music_length=music1.get_length()
music_length=len(music_length)
if pygame.mixer.music.get_busy() == False:
num += 1
......@@ -88,7 +92,16 @@ while True:
play_time=int(pygame.mixer.music.get_pos()/1000)
play_m=play_time//60
play_s=play_time%60
if play_s<10:
play_s='0'+str(play_s)
info=str(play_m)+':'+str(play_s)
#The songs' length
music_m=music_length//60
music_s=music_length%60
if music_s<10:
music_s='0'+str(music_s)
info2=str(music_m)+':'+str(music_s)
#
new_logo=pygame.transform.rotate(logo_img,angle)
newRect=new_logo.get_rect(center=(320,200))
pos=(newRect[0],newRect[1])
......@@ -103,6 +116,8 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲
scoreSurf=b_f.render(info,True,(255,255,255))
scoreSurf2=b_f.render('/'+info2,True,(0,0,0))
screen.blit(scoreSurf,(120,440))
screen.blit(scoreSurf2,(170,440))
# 刷新画面
pygame.display.update()
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