Commit aa902ad0 by BellCodeEditor

save project

parent c2b364ec
Showing with 16 additions and 10 deletions
...@@ -13,6 +13,8 @@ last_img = pygame.image.load('last.png') # 上一曲按钮 ...@@ -13,6 +13,8 @@ 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 logo_img = pygame.image.load('logo.png') # 中间logo
pygame.mixer.music.load("www.mp3") pygame.mixer.music.load("www.mp3")
start = stop_img
click = 0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -22,11 +24,10 @@ while True: ...@@ -22,11 +24,10 @@ while True:
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
pygame.mixer.music.play() pygame.mixer.music.play()
volume = 0.2 volume = 0.5
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
start = stop_img
click = 0
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
...@@ -41,14 +42,19 @@ while True: ...@@ -41,14 +42,19 @@ while True:
if volume < 0 or volume==0: if volume < 0 or 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:
click += 1 x,y=event.pos()
if click%2 == 0: if x>270 and x<370 and y>350 and y<450:
pygame.mixer.music.unpause() click += 1
start = stop_img if click%2 == 0:
else: pygame.mixer.music.unpause()
pygame.mixer.music.pause() start = stop_img
start = play_img screen.blit(start, (270, 330))
else:
pygame.mixer.music.pause()
start = play_img
screen.blit(start, (270, 330))
if volume <=0: if volume <=0:
volume = 0 volume = 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