# Game Opens then Stops Responding Python

Sorry for the bad title, if you think of a better one please tell me.

So I was asked to make a button that says a line from a video game. I attempted to have the while loop add 1 to a variable every time it looped through, then display the variable in the caption of the window. I did this so that I could see if it was looping, and really, what was going on. It showed a rapidly increasing number, then froze the computer (I had to restart the computer). I tried putting a short wait in the loop, still would not respond. I am also having this exact same problem in a much longer and more complex program that I'm working on, so if I figure it out, it will solve both issues. Don't just give me code, please tell me why I need to use it or what it does. Here's the program:

from pygame import *
import pygame
pygame.init()

pygame.display.set_caption('Potato')
screen = pygame.display.set_mode((224, 224))
screen.blit(button,(0,0))
pygame.display.flip()

potato = pygame.mixer.Sound("C:/Python34/potato.wav")

test = 0
pressed = False

while pressed == False:
if pygame.mouse.get_pressed()[1]:
pressed = True

if pygame.mouse.get_pressed()[0]:
potato.play()

sys.exit()


Note, remember to call pygame.event.get() before this function. Otherwise it will not work.
• And while I'm on the topic, it also says "it is better to use either pygame.event.wait() or pygame.event.get() and check all of (the accumulated) events" instead of just testing whether the mouse button happens to be down at this particular moment. – Trevor Powell May 14 '15 at 0:37