Commit e502815d by BellCodeEditor

save project

parent d10ddadd
Showing with 29 additions and 8 deletions
...@@ -13,7 +13,7 @@ last_img = pygame.image.load('last.png') # 上一曲按钮 ...@@ -13,7 +13,7 @@ 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') # 下一曲按钮
path="C:\\Users\\HP\\Desktop\\tese" path="C:\\Users\\12486\\Desktop\\test"
filelist = os.listdir(path) filelist = os.listdir(path)
music_list = [] music_list = []
for i in filelist: for i in filelist:
...@@ -45,7 +45,9 @@ while True: ...@@ -45,7 +45,9 @@ while True:
# 按下鼠标 # 按下鼠标
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSEBUTTONDOWN:
# 次数增加 if event.button ==1: # 次数增加
x,y = event.pos
if x > 270 and x < 370 and y > 350 and y < 450:
click += 1 click += 1
if click % 2 == 0: if click % 2 == 0:
play_button = stop_img play_button = stop_img
...@@ -54,12 +56,31 @@ while True: ...@@ -54,12 +56,31 @@ while True:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False: if x>120 and x<220 and y>350 and y<400:
num+=1 num-=1
if num > len(music_list)-1: if num < 0:
num = 0 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()
chlick = 0
play_button = stop_img
if x>420 and x<520 and y>350 and y<400:
num+=1
if num < 3:
num = len(music_list)-1
pygame.mixer.music.load(path+"\\"+music_list[num])
pygame.mixer.music.play()
chlick = 0
play_button = stop_img
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()
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
......
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