Commit fd01ca7b by BellCodeEditor

save project

parent 0ae40bf0
Showing with 11 additions and 4 deletions
...@@ -12,9 +12,9 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮 ...@@ -12,9 +12,9 @@ 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') # 下一曲按钮
angle = 0
music_list = [] music_list = []
path = "C:\\Users\\bellcode\\Desktop\\test" path = "C:\\Users\\HUAWEI\\Desktop\\test"
filelist = os.listdir(path) filelist = os.listdir(path)
num = -1 num = -1
for i in filelist: for i in filelist:
...@@ -41,7 +41,6 @@ while True: ...@@ -41,7 +41,6 @@ while True:
if volume < 0: if volume < 0:
volume = 0 volume = 0
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSEBUTTONDOWN:
if event.button == 1: # 左击 if event.button == 1: # 左击
x, y = event.pos x, y = event.pos
...@@ -50,9 +49,11 @@ while True: ...@@ -50,9 +49,11 @@ while True:
if click % 2 == 0: if click % 2 == 0:
play_button = stop_img play_button = stop_img
pygame.mixer.music.unpause() pygame.mixer.music.unpause()
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
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:
...@@ -76,10 +77,16 @@ while True: ...@@ -76,10 +77,16 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
new_logo = pygame.transform.rotate(logo_img,angle) new_logo = pygame.transform.rotate(logo_img,angle)
new_Rect = new_logo.get_rect(center=(320,200)) new_Rect = new_logo.get_rect(center=(320,200))
pos = (new_Rect[0],new_Rect[1]) pos = (new_Rect[0],new_Rect[1])
angle += 2 if click % 2 == 1:
angle -= 0.5
angle += 0.5
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
if num > len(music_list)-1: if num > len(music_list)-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