Commit 80bf84f7 by BellCodeEditor

auto save

parent 130b0862
Showing with 25 additions and 2 deletions
...@@ -14,7 +14,7 @@ next_img = pygame.image.load('next.png') # 下一曲按钮 ...@@ -14,7 +14,7 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮 logo_img = pygame.image.load('logo.png') # 下一曲按钮
music_list = [] music_list = []
path = "C:\\Users\\bellcode\\Desktop\\test" path = "C:\\Users\\86152\\Desktop\\test"
filelist = os.listdir(path) filelist = os.listdir(path)
num = -1 num = -1
for i in filelist: for i in filelist:
...@@ -23,6 +23,7 @@ for i in filelist: ...@@ -23,6 +23,7 @@ for i in filelist:
volume = 0.2 volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量 pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0 click = 0
jiaodu=0
play_button = stop_img play_button = stop_img
while True: while True:
...@@ -53,6 +54,7 @@ while True: ...@@ -53,6 +54,7 @@ while True:
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
jiaodu+=0
if x > 420 and x < 520 and y > 350 and y < 400: # 下一曲 if x > 420 and x < 520 and y > 350 and y < 400: # 下一曲
num += 1 num += 1
if num > len(music_list) - 1: if num > len(music_list) - 1:
...@@ -60,6 +62,11 @@ while True: ...@@ -60,6 +62,11 @@ while True:
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
m1 = pygame.mixer.Sound(path + "\\" + music_list[num])
ml = m1.get_length()
ml = int(ml)
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
else: else:
...@@ -71,6 +78,11 @@ while True: ...@@ -71,6 +78,11 @@ 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()
m1 = pygame.mixer.Sound(path + "\\" + music_list[num])
ml = m1.get_length()
ml = int(ml)
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -84,10 +96,21 @@ while True: ...@@ -84,10 +96,21 @@ while True:
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
m1 = pygame.mixer.Sound(path + "\\" + music_list[num])
ml = m1.get_length()
ml = int(ml)
# 绘制画面 # 绘制画面
new=pygame.transform.rotate(logo_img,jiaodu)
newz=new.get_rect(center=(320,200))
pos=(newz[0],newz[1])
if click % 2 ==0:
jiaodu+=1
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)) # 中间logo图 screen.blit(new, pos) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
......
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