pygame-menu
pygame-menu copied to clipboard
AttributeError when changing rangeslider value with an USB gamepad
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.