dbredred
dbredred

Reputation: 17

TypeError: 'int' object is not callable (Mac)

I am using python 3.4.3 on mac. I installed it with homebrew, so I am not sure if its just my code or if I need to reinstall.

here is the error I get:

File "~/Documents/python game/main/main.py", line 16, in ?
if Event.type == pygame.QUIT():
TypeError: 'int' object is not callable

Here is my Code:

import pygame

pygame.init()

gameDisplay = pygame.display.set_mode ((800, 600))

pygame.display.set_caption('game')

clock = pygame.time.Clock()

running = True

while running:

for Event in pygame.event.get():
    if Event.type == pygame.QUIT():
        running = False
    print(Event)

pygame.display.update()

clock.tick(30)

pygame.quit()
quit()

Upvotes: 0

Views: 742

Answers (1)

lain
lain

Reputation: 448

Your error is that you called pygame.QUIT. Or, pygame.QUIT is a number. So you get an error. you must do it like this:

...
if Event.type == pygame.QUIT:
    ...

Upvotes: 3

Related Questions