Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget selection sound not working #399

Closed
vnmabus opened this issue Mar 27, 2022 · 2 comments · Fixed by #402
Closed

Widget selection sound not working #399

vnmabus opened this issue Mar 27, 2022 · 2 comments · Fixed by #402
Labels

Comments

@vnmabus
Copy link
Contributor

vnmabus commented Mar 27, 2022

Describe the bug
The widget selection sound is not playing when I change the selected widget.

To Reproduce
As an example, use the example code that added the widget selection sound:

import pygame
import pygame_menu


pygame.init()
surface = pygame.display.set_mode((600, 400))

def set_difficulty(value, difficulty):
    pass

def start_the_game():
    print('Press button')

engine = pygame_menu.sound.Sound()
engine.set_sound(pygame_menu.sound.SOUND_TYPE_WIDGET_SELECTION, pygame_menu.sound.SOUND_EXAMPLES[-1])

menu = pygame_menu.Menu('Welcome', 400, 300, theme=pygame_menu.themes.THEME_BLUE)
menu.set_sound(engine, recursive=True)

menu.add.text_input('Name :', default='John Doe')
menu.add.selector('Difficulty :', [('Hard', 1), ('Easy', 2)], onchange=set_difficulty)
menu.add.button('Play', start_the_game)
menu.add.button('Quit', pygame_menu.events.EXIT)
menu.center_content()

menu.mainloop(surface)

Expected behavior
When you move between widgets, the sound should be played.

@vnmabus vnmabus added the bug label Mar 27, 2022
@vnmabus
Copy link
Contributor Author

vnmabus commented Apr 2, 2022

It seems that when used the keys instead of a joystick to select the widget, apply_sound is not set to True:

if self._current._down():

@ppizarror
Copy link
Owner

ppizarror commented Apr 2, 2022

Hi @vnmabus. Fixed in #402

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants