Commit b6eca8eb by BellCodeEditor

auto save

parent 130b0862
Showing with 34 additions and 6 deletions
......@@ -12,9 +12,11 @@ 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') # 下一曲按钮
neuropol_img=pygame.font.Font("neuropol.ttf",14)
agree=0
music_list = []
path = "C:\\Users\\bellcode\\Desktop\\test"
path = "C:\\Users\\Administrator\\Desktop\\test"
filelist = os.listdir(path)
num = -1
for i in filelist:
......@@ -53,18 +55,23 @@ while True:
else:
play_button = play_img
pygame.mixer.music.pause()
if x > 420 and x < 520 and y > 350 and y < 400: # 下一曲
num += 1
if num > len(music_list) - 1:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
pygame.mixer.musicy.play()
play_button = stop_img
play_lough=pygame.music.Sound(path + "\\" + music_list[num])
play_length=int(play_lough.get_length())
if click % 2 == 0:
click += 2
else:
click += 1
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1
if num < 0:
......@@ -72,23 +79,43 @@ while True:
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
play_button = stop_img
play_lough=pygame.mixer.music.Sound(path + "\\" + music_list[num])
play_length=int(play_lough.get_length())
if click % 2 == 0:
click += 2
else:
click += 1
playtime=pygame.mixer.music.get_pos()
playtime=int(playtime/1000)
playtime_m=(playtime//60)
playtime_s=(playtime%60)
info=str(playtime_m)+":"+str(playtime_s)
new_logo=pygame.transform.rotate(logo_img,agree)
new_rect=new_logo.get_rect(center=(320,200))
if play_button == stop_img:
agree+=1
if pygame.mixer.music.get_busy() == False:
num += 1
if num > len(music_list)-1:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
play_lough=pygame.mixer.Sound(path + "\\" + music_list[num])
play_length=int(play_lough.get_length())
play_length_m=(play_length//60)
play_length_s=(play_length%60)
info1="/"+str(play_length_m)+":"+str(playtime_s)
a=neuropol_img.render(info,True,(255,255,255))
b=neuropol_img.render(info1,True,(0,0,0))
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(logo_img, (170, 60)) # 中间logo图
screen.blit(new_logo, (new_rect[0],new_rect[1])) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
screen.blit(a,(120,440))
screen.blit(b,(140,440))
# 刷新画面
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