import pygame

def init():
    pygame.init()
    windows = pygame.display.set_mode((400,400))

def getKey(Key):
    output = False
    
    for every in pygame.event.get(): pass
    KeyInput = pygame.key.get_pressed()
    MyKey = getattr(pygame, f'K_{Key}')
    if KeyInput[MyKey]:
        output = True
    
    pygame.display.update()
    return output

def main():
    # print(getKey("a"))
    if getKey("LEFT"):
        print("LEFT KEY PRESSED")
    if getKey("RIGHT"):
        print("RIGHT KEY PRESSED")

if __name__ == '__main__':
    init()
    while True:
        main()          