Closed spiderman-idog closed 1 year ago
(Using pygame 2.1.2) Pianoputer closes itself when starting, and leaves this error:
line 287, in play_until_user_exits elif event.key == pygame.K_ESCAPE: AttributeError: 'Event' object has no attribute 'key'
Not sure if this bug happens in old pygame versions
It's needed to first check if the event type is pygame.KEYDOWN first, then check if the event key is pygame.K_ESCAPE
pygame.KEYDOWN
pygame.K_ESCAPE
Issue:
(Using pygame 2.1.2) Pianoputer closes itself when starting, and leaves this error:
Not sure if this bug happens in old pygame versions
Solution
It's needed to first check if the event type is
pygame.KEYDOWN
first, then check if the event key ispygame.K_ESCAPE