Terminal Interface Modules
tty
Helpers for raw and cbreak terminal modes on Unix. cfmakeraw and cfmakecbreak modify an attribute list in memory; setraw and setcbreak apply settings to a terminal descriptor. Cbreak disables canonical line buffering and echo. The example changes a synthetic list only, not a terminal.
Formal Syntax & Structure
python syntaxpython
import ttyReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
import tty, termiosmode = [0, 0, 0, termios.ECHO | termios.ICANON, 0, 0, [0]*termios.NCCS]tty.cfmakecbreak(mode)print(bool(mode[3] & termios.ECHO), mode[6][termios.VMIN])