while True:
key = cv2.waitKey(1) & 0xFF
# if the 'ESC' key is pressed, Quit
if key == 27:
quit()
if key == 0:
print "up"
elif key == 1:
print "down"
elif key == 2:
print "left"
elif key == 3:
print "right"
# 255 is what the console returns when there is no key press...
elif key != 255:
print(key)