# Why is my program “not responding” when I run it?

I'm trying to learn to code with python and while using pygame, I came across this: every time I run the window it says "not responding".

Specifically, it happens when I click to drag the window; the title changes to "not responding" and I do not know what to do.

Here is all of my code:

import pygame
pygame.init()

win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("Game Test")


Looking quickly at a hello world with pygame, I landed on this page.

Here is the code they use:

import pygame, sys
from pygame.locals import *

pygame.init()
DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Hello World!')
while True: # main game loop
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()


Your program needs to be "alive", this means that you need to have a main loop that will handle at least the events that are sent by the OS, Windows in your case.

If you don't process these events, windows will know about it and think that the program is frozen (i.e. not responding). You'll also want to make sure that you draw something (that's with the last line in the example).