You need to sign in or sign up before continuing.
Commit 5ced0db8 by BellCodeEditor

auto save

parent 349f0c91
Showing with 29 additions and 4 deletions
...@@ -12,9 +12,10 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮 ...@@ -12,9 +12,10 @@ 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') # 下一曲按钮
myfont=pygame.font.Font('neuropol.ttf',18)
music_list = [] music_list = []
path = "C:\\Users\\Administrator\\Desktop\\tast" path = "C:\\Users\\EDY\\Desktop\\text"
filelist = os.listdir(path) filelist = os.listdir(path)
num = -1 num = -1
for i in filelist: for i in filelist:
...@@ -59,6 +60,8 @@ while True: ...@@ -59,6 +60,8 @@ 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])
mh=int(music1.get_length())
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -71,6 +74,8 @@ while True: ...@@ -71,6 +74,8 @@ while True:
num = len(music_list) - 1 num = len(music_list) - 1
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])
mh=int(music1.get_length())
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -83,12 +88,31 @@ while True: ...@@ -83,12 +88,31 @@ 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])
mh=int(music1.get_length())
play_time=pygame.mixer.music.get_pos()
play_time=int(play_time/1000)
play_m=play_time//60
play_s=play_time%60
inof=str(play_m)+':'+str(play_s)
mh_m=mh//60
mh_s=mh%60
inof2=str(mh_m)+':'+str(mh_s)
new_logo = pygame.transform.rotate(logo_img, angle) new_logo = pygame.transform.rotate(logo_img, angle)
angle += 1 newRect=new_logo.get_rect(center=(320,196))
pos=(newRect[0],newRect[1])
if play_button == stop_img:
angle += 1
text=myfont.render(inof,True,(0,0,0))
text2=myfont.render('/'+inof2,True,(0,0,0))
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(logo_img, (170, 60)) 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))
screen.blit(text,(170,440))
screen.blit(text2,(220,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