When writing pygame, "the specified program error cannot be found", how can I solve it?

import sys

import pygame
class AlienInvasion:
    '''A class that manages game resources and behavior'''
    def _init_(self):
        '''Initialize the game and create game resources'''
        pygame.init()

        seli.screen = pygame.display.set_mode((1200,800))
        pygame.display.set_caption("Alien Invasion")
    def run_game(self):
        '''Start the main loop of the game'''
        while True:
            ''' Monitor keyboard and mouse events'''
            for event in pygame.event.get():
                if event.type == pygame.OUIT:
                    sys.exit()
                    '''Make the most recently drawn screen visible'''
                    pygame.display .flip()
if _name_ == '_main_':
    ai = AlienInvasion()
    ai.run_game()

 An error occurred during programming in the above picture. May I ask what is the reason for this situation? I also tried to put the written pygame program under the site-packages file, but this problem cannot be solved.

The figure below is the address to install pygame,

 

Guess you like

Origin blog.csdn.net/m0_62733000/article/details/126601146
Recommended