Skip to content

Instantly share code, notes, and snippets.

@wiktorpp
Created December 24, 2021 13:27
Show Gist options
  • Save wiktorpp/541852bb00fe328377b900fc26a20618 to your computer and use it in GitHub Desktop.
Save wiktorpp/541852bb00fe328377b900fc26a20618 to your computer and use it in GitHub Desktop.
import sys
import tty
import termios
def getchar():
tattr = termios.tcgetattr(sys.stdin)
tty.setcbreak(sys.stdin.fileno(), termios.TCSANOW)
out = sys.stdin.read(1)
termios.tcsetattr(sys.stdin, termios.TCSANOW, tattr)
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment