I'm trying to make it so that once you press the "X"
button on the window it closes. I've followed a tutorial but when it gets to the line:
pygame.quit()
It throws up a
TypeError: 'bool' object is not callable
Anyone know why this is? This is my code:
end = False
events = pygame.event.get()
while not end:
for event in pygame.event.get():
if event.type == pygame.QUIT:
end = True
gameDisplay.fill(white)
print (end)
pygame.display.update()
clock.tick(60)
print ("end")
pygame.quit()
quit()
EDIT
This is my program as it stands, still throwing up the same error
intro_text = False
white (225,225,225)
display_width = 1280
display_height = 660
t_lp = 0
text = "game time"
txtSize = 50
myfont= pygame.font.SysFont("Poor Richard",txtSize)
textSurface = myfont.render(text, False, (0,0,0))
while not intro_text:
gameDisplay.fill(white)
if t_lp == 0:
gameDisplay.blit(textSurface, (0.4*display_width, 0.2*display_height))
pygame.display.update()
clock.tick(60)
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
if t_lp == 1:
intro_text = True
if t_lp == 0:
gameDisplay.fill(white)
text = "After Trecking through Porky's dungeon, Jabe finally finds the Swine's final lair!"
txtSize = 25
textSurface = myfont.render(text, False, (0,0,0))
gameDisplay.blit(textSurface, (142, 0.5*display_height))
pygame.display.update()
t_lp =1
if event.type == pygame.QUIT:
pygame.quit()
quit()