From 7cbbc64d27fe533e27332371a332ffb298a82d3c Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 8 Feb 2025 19:51:52 -0500 Subject: [PATCH] Fixed a bug in learn sounds. Forgot to switch the if statement from == to in when converting to the list to also allow use of s and w for menu navigation. --- __init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index daf7aaa..f7ee25d 100755 --- a/__init__.py +++ b/__init__.py @@ -818,7 +818,11 @@ def learn_sounds(sounds): str: "menu" if user exits with escape """ loop = True - pygame.mixer.music.pause() + try: + pygame.mixer.music.pause() + except: + pass + currentIndex = 0 # Get list of available sounds, excluding special sounds @@ -839,9 +843,14 @@ def learn_sounds(sounds): event = pygame.event.wait() if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: + try: + pygame.mixer.music.unpause() + except: + pass + return "menu" - if event.key == [pygame.K_DOWN, pygame.K_s] and currentIndex < len(soundFiles) - 1: + if event.key in [pygame.K_DOWN, pygame.K_s] and currentIndex < len(soundFiles) - 1: pygame.mixer.stop() currentIndex += 1