Pygame window freezes when it opens [duplicate]

A minimal, typical PyGame application

  • needs a game loop

  • has to handle the events, by either pygame.event.pump() or pygame.event.get().

  • has to update the Surface whuch represents the display respectively window, by either pygame.display.flip() or pygame.display.update().

See also Python Pygame Introduction

Simple example, which draws a red circle in the center of the window: repl.it/@Rabbid76/PyGame-MinimalApplicationLoop

import pygame

pygame.init()
window = pygame.display.set_mode((500, 500))

# main application loop
run = True
while run:

    # event loop
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    # clear the display
    window.fill(0)

    # draw the scene   
    pygame.draw.circle(window, (255, 0, 0), (250, 250), 100)

    # update the display
    pygame.display.flip()