Ошибка: pygame.error: video system not initialized. почему?

import pygame

pygame.init()

pygame.display.set_mode((600, 400))

while 1:
    for i in pygame.event.get():
        if i == pygame.quit():
            pygame.quit()

Причём ошибку выдает именно в 8-ой строке.


Ответы (1 шт):

Автор решения: S. Nick

Попробуйте так:

import sys
import pygame

pygame.init()

pygame.display.set_mode((600, 400))

while 1:
    for i in pygame.event.get():
        print(f'111 {i}') 
        print(f'222 {pygame.event.get()}') 
        print(f'333 {i.type}') 
        print(f'444 {pygame.QUIT}') 
    
#        if i == pygame.quit():
#            pygame.quit()

        if i.type == pygame.QUIT:                          # +++
            sys.exit()                                     # +++
→ Ссылка