import pygame SIZE = (440, 240) window = pygame.display.set_mode(SIZE) screen = pygame.Surface(SIZE) class Platform: def __init__(self): self.fon = pygame.image.load('image/fon.png') self.blue = pygame.image.load('image/blue.png') def make_level(level, platform): x = 0 y = 0 for i in range(len(level)): for j in range(len(level[i])): if level[i][j] == 1: screen.blit(platform.fon, (x,y)) if level[i][j] == 2: screen.blit(platform.blue, (x,y)) x += 40 y += 40 x = 0 level = [ [0,0,0,0,0,0,0,0,0,0], [0,2,2,1,1,1,1,1,1,0], [0,2,2,1,1,1,1,1,1,0], [0,2,2,1,1,1,1,1,1,0]] pl = Platform() done = True while done: for e in pygame.event.get(): if e.type == pygame.QUIT: done = False if e.type == pygame.MOUSEBUTTONDOWN: (mouseA,mouseB) = pygame.mouse.get_pos() pix = 40 a = int(mouseA/pix) b = int(mouseB/pix) print('b,a = ',level[b][a]) if level[b][a] == 2: if e.type == pygame.MOUSEBUTTONDOWN: (mouseX,mouseY) = pygame.mouse.get_pos() x = int(mouseX/pix) y = int(mouseY/pix) print('y,x = ', level[y][x]) screen.fill((240,255,255)) make_level(level, pl) window.blit(screen, (0,0)) pygame.display.flip() It is necessary to rearrange the blue circles from the left to the right, but when I click the mouse (MOUSEBUTTONDOWN), the second click is immediately executed, how can I fix it?