Q:

Pygame, do command exactly 1 time when pressed a key then wait for another click

if key("LEFT"):
    if select_x ! = 100:
        select_x-=64
    else:
        print("BORDER REACHED")

If you run the Program and press the LEFT key, pygame will do the command written below forever until you stop pressing the key, I want pygame just to do the command 1 time and then waits for another click. 

A:

Do the event handling in the event loop for event in pygame.event.get()::
import pygame as pg

pg.init()
screen = pg.display.set_mode((320, 240))
clock = pg.time. Clock()
select_x = 164
done = False

while not done:
    for event in pg.event.get():
        if event.type == pg. QUIT:
            done = True
        elif event.type == pg. KEYDOWN:
            if event.key == pg. K_LEFT:
                if select_x ! = 100:
                    select_x -= 64
                else:
                    print("BORDER REACHED")

    screen.fill((30, 30, 30))
    pg.display.flip()
    clock.tick(30)

pg.quit()

