Commit 1a4f9e1c by BellCodeEditor

auto save

parent 2aadbf28
Showing with 3 additions and 15 deletions
...@@ -27,7 +27,7 @@ for i in file: ...@@ -27,7 +27,7 @@ for i in file:
volume = 0.2 volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量 pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0 click = 0
click_xy=(0,0)
play_button = stop_img play_button = stop_img
num=0 num=0
while True: while True:
...@@ -48,13 +48,10 @@ while True: ...@@ -48,13 +48,10 @@ while True:
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
# 按下鼠标 # 按下鼠标
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSEBUTTONDOWN:
# 获取点击处的坐标 # 获取点击处的坐标
click_xy=event.pos
click_x=click_xy[0]
click_y=click_xy[1]
# 按下音乐暂停/开始按钮处
if click_x>270 and click_x<370 and click_y>350 and click_y<450:
# 次数增加 # 次数增加
click += 1 click += 1
if click % 2 == 0: if click % 2 == 0:
...@@ -63,16 +60,7 @@ while True: ...@@ -63,16 +60,7 @@ while True:
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
# 按下上一曲
if click_x>120 and click_x<220 and click_y>350 and click_y<400:
num-=1
if num < 0:
num=len(music_list)-1
pygame.mixer.music.load(path+"\\"+music_list[num])
pygame.mixer.music.play()
click=0
play_button=stop_img
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
......
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