Bare Bones Pygame - Explained
basic explained.py
import pygame
pygame.init()
#screen is a Surface object (width, height):
screen = pygame.display.set_mode((400, 300))
done = False
while not done:
#pygame.event.get() empties event queue,
#so events don't pile up (unresponsive):
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
pygame.display.flip() #update the contents of the display
#the word 'flip' comes from flipping the display 'buffer' or memory.
#while one frame is displayed, the other is drawn.
#the roles are then 'flipped'. means you dont see the redraw (smooth).
pygame.quit()
end result:
