0

So i wanted to try out Pygame, and my code isnt even that complicated.

import pygame

pygame.init()
keylook = pygame.KEYDOWN(pygame.K_SPACE)

if keylook==True:
    print("Thats a Space key lol")

My Error code is

pygame 2.1.2 (SDL 2.0.18, Python 3.10.7)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
   File "C:\Users\Forth\Documents\development\python\gameshit.py", line 4, in <module>
     keylook = pygame.KEYDOWN(pygame.K_SPACE)
   TypeError: 'int' object is not callable
  • Should `pygame.KEYDOWN(pygame.K_SPACE)` be `pygame.key.get_pressed()[pygame.K_SPACE]`, or something similar? – Fiddling Bits Oct 10 '22 at 18:34
  • This question is clearly of the nature of not doing enough research. In almost every tutorial or example you can find an answer to your question. – Rabbid76 Oct 10 '22 at 18:41

0 Answers0