prafc
prafc

Reputation: 21

Pygame error: 'int' object is not callable

import pygame

pygame.init()
screen = pygame.display.set_mode((800, 600))
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT(): 
            running = False

When executing this code, I get the following error:

'int' object is not callable

Upvotes: 1

Views: 101

Answers (1)

jweightman
jweightman

Reputation: 353

pygame.QUIT is an int and not a function. Try removing the parentheses:

if event.type == pygame.QUIT:
    running = False

Upvotes: 1

Related Questions