Skip to content

Commit 760f603

Browse files
committed
Fix joystick last update mode
1 parent 07b53ea commit 760f603

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pygame_menu/menu.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Menu(Base):
108108
_auto_centering: bool
109109
_background_function: Tuple[bool, Optional[Union[Callable[['Menu'], Any], CallableNoArgsType]]]
110110
_clock: 'pygame.time.Clock'
111-
_column_max_width: VectorType
111+
_column_max_width: Union[List[None], VectorType]
112112
_column_max_width_zero: List[bool]
113113
_column_min_width: VectorType
114114
_column_pos_x: List[NumberType]
@@ -339,6 +339,7 @@ def __init__(
339339
# Check that every column max width is equal or greater than minimum width
340340
for i in range(len(column_max_width)):
341341
if column_max_width[i] is not None:
342+
# noinspection PyTypeChecker
342343
assert column_max_width[i] >= column_min_width[i], \
343344
f'item {i} of column_max_width ({column_max_width[i]}) must be equal or greater ' \
344345
f'than column_min_width ({column_min_width[i]})'
@@ -724,6 +725,7 @@ def resize(
724725
# Update column max width
725726
for i in range(len(self._column_max_width)):
726727
if self._column_max_width_zero[i]:
728+
# noinspection PyTypeChecker
727729
self._column_max_width[i] = self._width
728730

729731
# Force the rendering
@@ -2280,6 +2282,7 @@ def _exit(self) -> None:
22802282
# noinspection PyUnresolvedReferences,PyProtectedMember
22812283
os._exit(1)
22822284
# This should be unreachable
2285+
# noinspection PyUnreachableCode
22832286
exit(0)
22842287

22852288
def is_enabled(self) -> bool:
@@ -2652,19 +2655,19 @@ def update(self, events: EventVectorType) -> bool:
26522655

26532656
elif self._ctrl.joy_down(event, self):
26542657
if self._current._up(apply_sound=True):
2655-
self._current._last_update_mode = _events.MENU_LAST_MOVE_UP
2658+
self._current._last_update_mode = [_events.MENU_LAST_MOVE_UP]
26562659
updated = True
26572660
break
26582661

26592662
elif self._ctrl.joy_left(event, self):
26602663
if self._current._left(apply_sound=True):
2661-
self._current._last_update_mode = _events.MENU_LAST_MOVE_LEFT
2664+
self._current._last_update_mode = [_events.MENU_LAST_MOVE_LEFT]
26622665
updated = True
26632666
break
26642667

26652668
elif self._ctrl.joy_right(event, self):
26662669
if self._current._right(apply_sound=True):
2667-
self._current._last_update_mode = _events.MENU_LAST_MOVE_RIGHT
2670+
self._current._last_update_mode = [_events.MENU_LAST_MOVE_RIGHT]
26682671
updated = True
26692672
break
26702673

0 commit comments

Comments
 (0)