#!/usr/bin/env python3 import sys import time import pygame def refresh_screen(): for row_idx, row in enumerate(grid): for col_idx, element in enumerate(row): if element is not None: screen.blit(white_piece, (col_idx * 50 + 1, row_idx * 50 + 1)) pygame.init() black = (0, 0, 0) white = (0xff, 0xff, 0xff) white_piece = pygame.Surface((48, 48)) white_piece.fill(white) screen = pygame.display.set_mode((500, 1000)) grid = [[True for _ in range(10)] for _ in range(20)] while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() time.sleep(.1) refresh_screen() pygame.display.flip()