I'm just starting out and learning Python/PyGame. I'm currently following a tutorial but have run into the following error whenever a key is pressed:
File "wormy.py", line 134, in checkForKeyPress
return keyUpEvents[0].keyUpEvents
AttributeError: event member not defined
The actual code in question is:
def checkForKeyPress():
if len(pygame.event.get(QUIT)) > 0:
terminate()
keyUpEvents = pygame.event.get(KEYUP)
if len(keyUpEvents) == 0:
return None
if keyUpEvents[0].key == K_ESCAPE:
terminate()
return keyUpEvents[0].keyUpEvents
Could someone explain what I'm doing wrong here please?