Description
Related Tags
from ptkeyboard.keylistener import KeyPressListener
from time import sleep

up = KeyPressListener("up")
down = KeyPressListener("down")
left = KeyPressListener("left")
right = KeyPressListener("right")

while True:
    if up.is_pressed:
        print ("Up is pressed")
        sleep(.5)
    if down.is_pressed:
        print ("Down is pressed")
        sleep(.5)
    if left.is_pressed:
        print ("Left is pressed")
        sleep(.5)
    if right.is_pressed:
        print ("Right is pressed")
        sleep(.5)