Walls around edges
wall_of_blocks.py
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
walls=[]
for x in range(0,400,25): walls.append(pygame.Rect(x,0,25,25)) #top wall
for x in range(0,400,25): walls.append(pygame.Rect(x,275,25,25)) #bottom wall
for y in range(0,325,25): walls.append(pygame.Rect(0,y,25,25)) #left wall
for y in range(0,325,25): walls.append(pygame.Rect(375,y,25,25)) #right wall
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.fill((255, 255, 255))
for wall in walls:
pygame.draw.rect(screen, (255,0,0), wall)
pygame.display.flip()
pygame.quit()