Advertisement
PaweU

tmp

Dec 24th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import pygame, sys
  2.  
  3. screen = pygame.display.set_mode((1280, 720))
  4. rozmiar = 50
  5. odstep = 8
  6. plansza = 10
  7. bialy = (255, 255, 255)
  8. tlo = (0, 0, 200)
  9.  
  10. def rysujPlansze ():
  11. pygame.draw.rect(screen, tlo, pygame.Rect(0, 0, plansza * (rozmiar + odstep) + odstep,
  12. plansza * (rozmiar + odstep) + odstep))
  13. for i in range(plansza):
  14. for j in range(plansza):
  15. if j == 0 and i == 0:
  16. kolor = tlo
  17. elif i == 0 or j == 0:
  18. kolor = (169, 169, 169) # szary
  19. else:
  20. kolor = bialy
  21. pygame.draw.rect(screen, kolor, pygame.Rect(odstep + j * (rozmiar + odstep),
  22. odstep + i * (rozmiar + odstep),
  23. rozmiar, rozmiar))
  24.  
  25. while True:
  26. for event in pygame.event.get():
  27. if event.type == pygame.QUIT:
  28. sys.exit(0)
  29.  
  30. screen.fill ((0,0,0))
  31. rysujPlansze()
  32.  
  33.  
  34. pygame.display.flip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement