Pygame Freezes on Exit/Quit
<p>I have done research about this problem, on internet, but there was no solution for my case... The window freezes when i try to close it with (X) button.
And as I said I haven't came across any solution on other posts, so I came here to ask for help. Thank you.</p>

<pre><code>#!/usr/bin/python
import sys
import pygame
# initialize
pygame.init()
# colors 
black = (0,0,0)
white = (255,255,255)
red = (255,0,0)
green = (0,255,0)

# window size
w_size = [700,500]
main_screen = pygame.display.set_mode(w_size)
# Window info
pygame.display.set_caption("Cancer Cell")

# manage screen update time
clock=pygame.time.Clock()

#background image
bg_img = pygame.image.load("/img/bg_img.png").convert()

# Main loop
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
    # GAME LOGIC - BEGINNING


    # -------- DRAWINGS - BEGINNING --------
    main_screen.blit(bg_img, [0,0])
    # -------- DRAWINGS - END ----------


    # update screen
    pygame.display.flip()
    clock.tick(20) # 20 FPS limit for loop.

pygame.quit()
</code></pre>

<p>So it turns out that the IDLE is what was causing the problem...
I tried to run the code from commandline and it worked perfectly!</p>

<p>The IDLE that I (was) using is called Wing101.</p>

python pygame