The error message "pygame.error: video system not initialized" is typically caused by not initializing the pygame library before trying to use it. In your code, you have called pygame.init(), which should initialize the library and allow you to use it.
The problem may be caused by a problem with the pygame.event.get() line. Specifically, it seems that you are missing the colon at the end of the if event.type == pygame.quit() line. This means that the code inside the if block will never be executed, and the running loop will never exit.
You should also be comparing event.type to pygame.QUIT, not calling pygame.quit(). This means you should replace if event.type == pygame.quit() with if event.type == pygame.QUIT:
Here's the corrected code:
import pygame pygame.init() screen = pygame.display.set_mode((800, 600)) running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False
It's always good practice to close the game window to avoid getting any window handle errors, So you can also use pygame.quit() after the while loop ends to close the window and free up resources.
Try running this corrected code, and let me know if you still encounter any issues.