Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. def resetGrid(display_player):
  2. canvas.delete("all")
  3. if display_player:
  4. colourMatrix[player_y][player_x] = COLOUR_PLAYER
  5.  
  6. rows, cols = len(colourMatrix), len(colourMatrix[0])
  7.  
  8. rect_width = canvas_width // cols
  9. rect_height = canvas_height // cols
  10. for y, row in enumerate(colourMatrix):
  11. for x, colour in enumerate(row):
  12. x0, y0 = x * rect_width, y * rect_height
  13. x1, y1 = x0 + rect_width-1, y0 + rect_height-1
  14. #Still deciding on whether to use colours or text
  15. canvas.create_rectangle(x0, y0, x1, y1, fill=colour, width=0, outline=colour)
  16. #canvas.create_text(((x0+x1)/2), ((y0+y1)/2), fill=colour, font="Times 50", text = "@")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement