Advertisement
Guest User

grid.py

a guest
Oct 23rd, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import pygame
  2.  
  3. WIDTH = 800
  4. WIN = pygame.display.set_mode((WIDTH, WIDTH))
  5. GREY = (128, 128, 128)
  6.  
  7. def draw_grid(win, width):
  8.     square_count = 50
  9.     square_size = width // square_count
  10.     for i in range(square_count):
  11.         pygame.draw.line(win, GREY, (0, i*square_size), (width, i*square_size))
  12.         pygame.draw.line(win, GREY, (i*square_size, 0), (i*square_size, width))
  13.     pygame.display.update()
  14.  
  15. run = True
  16. square_count = 50
  17.  
  18. draw_grid(WIN, WIDTH)
  19. while run:
  20.     for event in pygame.event.get():
  21.             if event.type == pygame.QUIT:
  22.                 run = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement