Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame, sys
- screen = pygame.display.set_mode((1280, 720))
- rozmiar = 50
- odstep = 8
- plansza = 10
- bialy = (255, 255, 255)
- tlo = (0, 0, 200)
- def rysujPlansze ():
- pygame.draw.rect(screen, tlo, pygame.Rect(0, 0, plansza * (rozmiar + odstep) + odstep,
- plansza * (rozmiar + odstep) + odstep))
- for i in range(plansza):
- for j in range(plansza):
- if j == 0 and i == 0:
- kolor = tlo
- elif i == 0 or j == 0:
- kolor = (169, 169, 169) # szary
- else:
- kolor = bialy
- pygame.draw.rect(screen, kolor, pygame.Rect(odstep + j * (rozmiar + odstep),
- odstep + i * (rozmiar + odstep),
- rozmiar, rozmiar))
- while True:
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- sys.exit(0)
- screen.fill ((0,0,0))
- rysujPlansze()
- pygame.display.flip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement