Reputation: 271
I have been following a youtube series on how to make a game in pygame, and I keep getting this error about the QUIT event, and I don't know how to fix it.
Here is the error:
Traceback (most recent call last):
File "C:/Users/Brady/Desktop/Python Programs/Climber.py", line 31, in <module>
if event.type == pygame.QUIT():
TypeError: 'int' object is not callable
Here is the code:
#Imports
import pygame
import sys
import random
import cx_Freeze
#Variables
playerhealth = 100
black = (0, 0, 0)
white = (255, 255, 255)
red = (255, 0, 0)
green = (0 ,255, 0)
#Functions
#Initialization
pygame.init()
gamedisplay = pygame.display.set_mode((800, 800))
pygame.display.set_caption("Climber")
#Game Loop
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT():
pygame.quit()
quit()
gamedisplay.fill(white)
pygame.display.update()
Please help me with this error, and any other errors that are in the code.
Upvotes: 0
Views: 51
Reputation: 21619
Use pygame.QUIT
. It's an integer constant not a function.
e.g
if event.type == pygame.QUIT:
Upvotes: 2