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

AttributeError when changing rangeslider value with an USB gamepad #478

Open
derUli opened this issue Feb 17, 2024 · 0 comments
Open

AttributeError when changing rangeslider value with an USB gamepad #478

derUli opened this issue Feb 17, 2024 · 0 comments
Labels

Comments

@derUli
Copy link

derUli commented Feb 17, 2024

Environment information
Describe your environment information, such as:

  • OS: Windows 11
  • python version: 3.11.7
  • pygame version: pygame-ce 2.4.0
  • pygame-menu version: 4.4.3

Describe the bug
pygame-menu crashes when changing a rangeslider's value using a controller.

  File "C:\Users\useraccount\AppData\Roaming\Python\Python311\site-packages\pygame_menu\menu.py", line 3027, in mainloop
    self.update(pygame.event.get())
  File "C:\Users\useraccount\AppData\Roaming\Python\Python311\site-packages\pygame_menu\menu.py", line 2566, in update
    selected_widget.update_menu(events)
  File "C:\Users\useraccount\AppData\Roaming\Python\Python311\site-packages\pygame_menu\widgets\core\widget.py", line 2762, in update_menu
    return self.update(events)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\useraccount\AppData\Roaming\Python\Python311\site-packages\pygame_menu\widgets\widget\rangeslider.py", line 962, in update
    if self._left_right(event, True):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\useraccount\AppData\Roaming\Python\Python311\site-packages\pygame_menu\widgets\widget\rangeslider.py", line 880, in _left_right
    if event.key not in self._keyrepeat_counters:
       ^^^^^^^^^
AttributeError: 'pygame.event.Event' object has no attribute 'key'

To Reproduce
Just make a pygame-menu with a rangeslider.
Run the app and try to change the value using the left stick or arrow keys of an USB gaming controller.

Expected behavior
Should change the value like it does when pressing left arrow or right arrow on a PC keyboard.

Additional context
I am using an Xbox 360 style USB gaming controller.
But it seems to be a general error not related to specific hardware.

@derUli derUli added the bug label Feb 17, 2024
@derUli derUli changed the title AttributeError when updating rangeslider value with an USB gamepad AttributeError when changing rangeslider value with an USB gamepad Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant