• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1:mod:`tty` --- Terminal control functions
2=========================================
3
4.. module:: tty
5   :platform: Unix
6   :synopsis: Utility functions that perform common terminal control operations.
7
8.. moduleauthor:: Steen Lumholt
9.. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
10
11**Source code:** :source:`Lib/tty.py`
12
13--------------
14
15The :mod:`tty` module defines functions for putting the tty into cbreak and raw
16modes.
17
18Because it requires the :mod:`termios` module, it will work only on Unix.
19
20The :mod:`tty` module defines the following functions:
21
22
23.. function:: setraw(fd, when=termios.TCSAFLUSH)
24
25   Change the mode of the file descriptor *fd* to raw. If *when* is omitted, it
26   defaults to :const:`termios.TCSAFLUSH`, and is passed to
27   :func:`termios.tcsetattr`.
28
29
30.. function:: setcbreak(fd, when=termios.TCSAFLUSH)
31
32   Change the mode of file descriptor *fd* to cbreak. If *when* is omitted, it
33   defaults to :const:`termios.TCSAFLUSH`, and is passed to
34   :func:`termios.tcsetattr`.
35
36
37.. seealso::
38
39   Module :mod:`termios`
40      Low-level terminal control interface.
41
42