Pygame drawings only appear once I exit window
<p>I've created a rect, using Pygame display but it only appears 
in the Pygame window when I exit the window. </p>

<p>Have I done something wrong with my game loop?
I'm trying to set keydown events but it's not 
registering in the game loop. Maybe it's because 
the Pygame window only appears after I exit?</p>

<p>Got it.
I had incorrect indentation in my while loop.</p>

<p>However, when I run print(event) Python shows KEYDOWN but my rect won't move.</p>

<p>Here is a bit of my code:</p>

<pre><code>gameDisplay=pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('SssSss')

lead_x = 300
lead_y = 300

gameDisplay.fill(white)
pygame.draw.rect(gameDisplay, black, [lead_x, lead_y, 10, 10])
pygame.display.update()


gameExit=False

while not gameExit:
     for event in pygame.event.get(): 
        print (event) 

         if (event.type == pygame.QUIT):
            gameExit=True

         if (event.type == pygame.KEYDOWN):
            if event.key == pygame.K_LEFT:
                 lead_x -= 10
            if event.key == pygame.K_RIGHT:
                 lead_x += 10

pygame.display.update() 
</code></pre>

python pygame keydown