Just a few typos. This is mainly use for testing.
# It double underscore. if __name__ == '__main__': # It lower case main to match your function. main()Example
import pygame def main(): # Active all pygame modules. pygame.init() surface = pygame.display.set_mode((900, 500)) # Get the area of the surface as a rect. rect = surface.get_rect() clock = pygame.time.Clock() fps = 60 run = True while run: for event in pygame.event.get(): if event.type == pygame.QUIT: run = False surface.fill('black') # Render surface to screen. pygame.display.flip() # Let the computer do other jobs or rest. clock.tick(fps) pygame.quit() main()
99 percent of computer problems exists between chair and keyboard.