Jul-07-2019, 03:58 PM
I found the below code to start with, problem is, when i try to click on any block it still prints the message. How to make the message appear on specific block?
for row in range(0,3,1): for column in range(3,6,1): color = GREEN mouse = pygame.mouse.get_pos() click = pygame.mouse.get_pressed() x = (MARGIN + WIDTH) * column + MARGIN y = (MARGIN + HEIGHT) * row + MARGIN pygame.draw.rect(screen, color, [x, y, WIDTH, HEIGHT]) if x+WIDTH > mouse[0] > x and y+HEIGHT > mouse[1] > y: if click[0] == 1: print("clicked")