import pygame
from pygame.locals import *
if __name__ == "__main__":
pygame.init()
surface = pygame.display.set_mode((800,400))
pygame.display.flip()
running = True
while running:
for event in pygame.event.get():
if event.type == KEYDOWN:
print(event.key)
if event.key == K_ESCAPE:
running = False
if event.type == QUIT:
running = False
If pygame isn't working, try swtiching the compiler or creating a venv in the directory and installing pygame there,