2

so this is exactly what I wrote in vs code

import pygame


WIDTH, HEIGHT = 600, 500

WIN = pygame.display.set_mode((WIDTH, HEIGHT))

running = True

while running:
 for event in pygame.event.get():
  if event.type == pygame.QUIT:
   running = False
   

I get the error Module 'pygame' has no 'QUIT' member there is an error in if statement

   if event.type == pygame.QUIT:

its pygame.QUIT

1 Answers1

0

Reason: For security reasons, Pylint only trusts C extensions from the standard library stdlib by default, but the module "pygame" does not come from it.

Please add the following settings in settings.json to add it to the whitelist:

"python.linting.pylintArgs": ["--extension-pkg-whitelist=pygame"],

enter image description here

Or use the following settings:

 "python.linting.pylintArgs": [ "--errors-only", "--generated-members=pygame.* " ]

enter image description here

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25