Reputation: 105
This is extremely annoying and I don't know why it's happening. Here's the code:
import pygame
from sys import exit
def createWin(x, y):
winCreate = True
while winCreate:
win = pygame.display.set_mode((x, y))
if event.type == pygame.QUIT:
pygame.quit()
exit()
createWin(1000, 1000)
I get this error:
NameError: name 'event' is not defined
Upvotes: 1
Views: 6958
Reputation: 899
You should do -
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit()
Otherwise python will not recognize event
!
Upvotes: 5