Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- WHITE = (255, 255, 255)
- BLACK = (0, 0, 0)
- pygame.init()
- PDR = pygame.Rect(0, 0, 600, 600)
- PDS = pygame.display.set_mode(PDR.size)
- FONT = pygame.font.SysFont("arial", 20)
- # create a checker board
- checker = pygame.Surface((512, 512))
- for pos in range(64):
- pygame.draw.rect(checker, WHITE if (pos + pos // 8 % 2) % 2 else BLACK, (pos % 8 * 64, pos // 8 * 64, 64, 64))
- PDS.blit(checker, (44, 44))
- # display letters and numbers
- for pos in range(8):
- a = FONT.render("ABCDEFGH"[pos], False, WHITE)
- b = FONT.render(str(pos + 1), False, WHITE)
- PDS.blit(a, (-a.get_rect().w // 2 + 76 + pos * 64, -a.get_rect().h // 2 + 578))
- PDS.blit(b, (-a.get_rect().h // 2 + 22, -a.get_rect().w // 2 + 76 + pos * 64))
- pygame.display.update()
- exit_demo = False
- while not exit_demo:
- for e in pygame.event.get():
- if e.type == pygame.KEYUP:
- if e.key == pygame.K_ESCAPE: exit_demo = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement