Skip to content

Instantly share code, notes, and snippets.

@kgriffs
Created June 7, 2013 00:52
Show Gist options
  • Save kgriffs/5726314 to your computer and use it in GitHub Desktop.
Save kgriffs/5726314 to your computer and use it in GitHub Desktop.
Disable echo in Python
def enable_echo(enable):
fd = sys.stdin.fileno()
new = termios.tcgetattr(fd)
if enable:
new[3] |= termios.ECHO
else:
new[3] &= ~termios.ECHO
termios.tcsetattr(fd, termios.TCSANOW, new)
atexit.register(enable_echo, True)
enable_echo(False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment