how to make a simple pygame windows code example
Example 1: how to create a window in pygame
import pygame
pygame.init()
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 800
WIN = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
while True:
pygame.display.update()
Example 2: how to make a screen with pygame
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