Commit 292a74de by BellCodeEditor

save project

parent 6dd9939f
Showing with 25 additions and 4 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') # 下一曲按钮
my_font=pygame.font.Font('neuropol.ttf',16)
music_list = [] music_list = []
path = "C:\\Users\\lenovo\\Desktop\\text" path = "C:\\Users\\lenovo\\Desktop\\text"
filelist = os.listdir(path) filelist = os.listdir(path)
...@@ -58,12 +58,14 @@ while True: ...@@ -58,12 +58,14 @@ while True:
if num > len(music_list) - 1: if num > len(music_list) - 1:
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()
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
else: else:
click += 1 click += 1
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music_long=int(music1.get_length())
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
...@@ -76,6 +78,8 @@ while True: ...@@ -76,6 +78,8 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music_long=int(music1.get_length())
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
...@@ -83,18 +87,34 @@ while True: ...@@ -83,18 +87,34 @@ 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_long=int(music1.get_length())
new_logo = pygame.transform.rotate(logo_img, angle) new_logo = pygame.transform.rotate(logo_img, angle)
newrect=new_logo.get_rect(center=(320,200)) newrect=new_logo.get_rect(center=(320,200))
pos=(newrect[0],newrect[1]) pos=(newrect[0],newrect[1])
angle += 1 if click % 2 == 0:
angle += 1
time=int(pygame.mixer.music.get_pos()/1000) time=int(pygame.mixer.music.get_pos()/1000)
m=time//60 m=time//60
s=time%60 s=time%60
if s<10:
s='0'+str(s)
m_m=music_long//60
m_s=music_long%60
if m_s<10:
m_s='0'+str(m_s)
info=str(m)+':'+str(s) info=str(m)+':'+str(s)
info2='/'+str(m_m)+':'+str(m_s)
screen.blit(bg_img, (0, 0)) screen.blit(bg_img, (0, 0))
screen.blit(play_button, (270, 330)) screen.blit(play_button, (270, 330))
screen.blit(new_logo,pos) screen.blit(new_logo,pos)
screen.blit(last_img, (120, 350)) screen.blit(last_img, (120, 350))
screen.blit(next_img, (420, 350)) screen.blit(next_img, (420, 350))
print(info) text=my_font.render(info,True,(255,255,255))
screen.blit(text,(120,440))
text2=my_font.render(info2,True,(255,255,255))
screen.blit(text2,(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