1

I have the following code:

import pygame

win = pygame.display.set_mode((600,600))

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

VS Code underlines pygame.QUIT and says: Module 'pygame' has no 'QUIT' memberpylint(no-member) The code still works so there is a quit... Any Ideas how to fix ?

derpascal
  • 172
  • 1
  • 10

1 Answers1

0

The init() function is missing

pygame.init()

Here's the full code :

import pygame
import sys

pygame.init()

win = pygame.display.set_mode((600, 600))

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

    pygame.display.update()

pygame.quit()
sys.exit()

Here is a more detailed explanation of what init does.
Do let me know through a comment if this doesn't works for you.

root
  • 192
  • 13
CopyrightC
  • 857
  • 2
  • 7
  • 15