blob: fc9672f944d3bc4ee78c273d352033f7a889dc40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/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()
|