pygame game manager class code example
Example 1: python pygame screen example
import pygame
background_colour = (255,255,255)
(width, height) = (300, 200)
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('Tutorial 1')
screen.fill(background_colour)
pygame.display.flip()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
Example 2: python pygame
import pygame
import sys
pygame.init()
frames_per_second = 30
window_height = 600
window_width = 400
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)
display = pygame.display.set_mode((window_width, window_height))
clock = pygame.time.Clock()
while True:
clock.tick(frames_per_second)
display.fill(WHITE)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()