More event handling to help with pyinstaller compilation.
This commit is contained in:
5
menu.py
5
menu.py
@@ -184,6 +184,7 @@ def game_menu(sounds, playCallback=None, *customOptions):
|
||||
pygame.mixer.stop()
|
||||
currentIndex = 0
|
||||
lastSpoken = -1 # Track last spoken index
|
||||
pygame.event.clear()
|
||||
|
||||
while loop:
|
||||
if currentIndex != lastSpoken:
|
||||
@@ -337,7 +338,8 @@ def game_menu(sounds, playCallback=None, *customOptions):
|
||||
pass
|
||||
return allOptions[currentIndex]
|
||||
|
||||
event = pygame.event.clear()
|
||||
pygame.event.pump()
|
||||
pygame.event.clear()
|
||||
time.sleep(0.001)
|
||||
|
||||
def learn_sounds(sounds):
|
||||
@@ -422,6 +424,7 @@ def learn_sounds(sounds):
|
||||
|
||||
# Flag to track when to exit the loop
|
||||
returnToMenu = False
|
||||
pygame.event.clear()
|
||||
|
||||
while not returnToMenu:
|
||||
# Announce current sound
|
||||
|
Reference in New Issue
Block a user