From 956290a73b049d14ed268502dd6718e6ffdadcfb Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Tue, 13 Oct 2020 15:55:56 +0800 Subject: [PATCH] save project --- my_music.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/my_music.py b/my_music.py index 50cd910..4e53464 100644 --- a/my_music.py +++ b/my_music.py @@ -21,7 +21,9 @@ click = 0 play_button = stop_img while True: + for event in pygame.event.get(): + print(event) if event.type == locals.QUIT: exit() # 按键,控制声音大小 @@ -38,13 +40,16 @@ while True: pygame.mixer.music.set_volume(volume) if event.type == locals.MOUSEBUTTONDOWN: - click += 1 - if click % 2 == 0: - play_button = stop_img - pygame.mixer.music.unpause() - else: - play_button = play_img - pygame.mixer.music.pause() + if event.button==1: + x,y=event.pos + if x>270 and x<370 and y>330 and y<430: + click += 1 + if click % 2 == 0: + play_button = stop_img + pygame.mixer.music.unpause() + else: + play_button = play_img + pygame.mixer.music.pause() if pygame.mixer.music.get_busy() == False: pygame.mixer.music.play() -- libgit2 0.25.0