Whenever I try to run event.type == pygame.QUIT
, event.type == QUIT
or event.type == pygame.quit()
in my pygame program, I get an error saying that Module 'pygame' has no 'QUIT' member
or Undefined variable 'QUIT'
. When I run the program, it opens just fine but when I close out of the pygame window, it crashes completely and doesn't close.
I have tried to reinstall pygame but that didn't work. It seems like the pygame package has no quit function of any kind, even though the other functions like Clock()
and display()
are there. I think that it might have to do with installation issues, but I don't know how to address that in a concise way.
Here's my code:
import pygame, sys
from pygame.locals import *
from sys import exit
import os
from moves import Moves
from moves import *
from character import Character
from items import Items
import random
import pandas as pd
from pokemon import Pokemon
...
running = True
FPS = 60
clock = pygame.time.Clock()
while running:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == QUIT:
running=False