Staging: this is not the live site, pydocs.org.
Command-line interface libraries curses not Android not iOS not WASI
curses
The main package for curses support for Python. Normally used by importing
the package, and perhaps a particular module inside it.
import curses
from curses import textpad
curses.initscr()
... © Python Software Foundation. PSF License Version 2 · Official docs ↗
Symbols in curses a A_COLOR Bit-mask to extract color-pair field information A_REVERSE Reverse background and foreground colors ACS_BBSS alternate name for upper-right corner ACS_BSBS alternate name for horizontal line ACS_BSSB alternate name for upper-left corner ACS_SBBS alternate name for lower-right corner ACS_SBSB alternate name for vertical line ACS_SSBB alternate name for lower-left corner ACS_SSSS alternate name for crossover or big plus b baudrate Return the output speed of the terminal in bits per second. beep Emit a short attention sound. c can_change_color Return True if the programmer can change the colors displayed by the terminal. color_content Return the red, green, and blue (RGB) components of the specified color. color_pair Return the attribute value for displaying text in the specified color. COLOR_PAIRS The maximum number of color pairs the terminal can support. COLORS The maximum number of colors the terminal can support. COLS The width of the screen, that is, the number of columns. d def_prog_mode Save the current terminal mode as the "program" mode. doupdate Update the physical screen to match the virtual screen. e endwin De-initialize the library, and return terminal to normal status. erasechar Return the user's current erase character. ERR Some curses routines that return an integer, such as getch(), return ERR upon failure. error Exception raised when a curses library function returns an error. f filter Restrict screen updates to the current line. g getmouse Retrieve the queued mouse event. getsyx Return the current coordinates of the virtual screen cursor. getwin Read window related data stored in the file by an earlier putwin() call. h has_colors Return True if the terminal can display colors; otherwise, return False. has_ic Return True if the terminal has insert- and delete-character capabilities. has_il Return True if the terminal has insert- and delete-line capabilities. has_key Return True if the current terminal type recognizes a key with that value. i init_pair Change the definition of a color-pair. intrflush Control flushing of the output buffer when an interrupt key is pressed. is_term_resized Return True if resize_term() would modify the window structure, False otherwise. isendwin Return True if endwin() has been called. k KEY_IC Insert char or enter insert mode KEY_LL Home down or bottom (lower left) KEY_SR Scroll 1 line backward (reverse) keyname Return the name of specified key. killchar Return the user's current line kill character. l LINES The height of the screen, that is, the number of lines. longname Return the terminfo long name field describing the current terminal. m meta Enable/disable meta keys. mouseinterval Set and retrieve the maximum time between press and release in a click. mousemask Set the mouse events to be reported, and return (availmask, oldmask). n napms Sleep for specified time. ncurses_version A named tuple containing the three components of the ncurses library version: major, minor, and patch. newpad Create and return a pointer to a new pad data structure. o OK Some curses routines that return an integer, such as napms(), return OK upon success. p pair_content Return a tuple (fg, bg) containing the colors for the requested color pair. pair_number Return the number of the color-pair set by the specified attribute value. putp Emit the value of a specified terminfo capability for the current terminal. r reset_prog_mode Restore the terminal to "program" mode, as previously saved by def_prog_mode(). reset_shell_mode Restore the terminal to "shell" mode, as previously saved by def_shell_mode(). resize_term Backend function used by resizeterm(), performing most of the work. resizeterm Resize the standard and current windows to the specified dimensions. s setsyx Set the virtual screen cursor. start_color Initializes eight basic colors and global variables COLORS and COLOR_PAIRS. t termattrs Return a logical OR of all video attributes supported by the terminal. termname Return the value of the environment variable TERM, truncated to 14 characters. tigetflag Return the value of the Boolean capability. tigetnum Return the value of the numeric capability. tigetstr Return the value of the string capability. tparm Instantiate the specified byte string with the supplied parameters. typeahead Specify that the file descriptor fd be used for typeahead checking. u unctrl Return a bytes object which is a printable representation of ch. unget_wch Push ch so the next get_wch() will return it. ungetch Push ch so the next getch() will return it. ungetmouse Push a KEY_MOUSE event onto the input queue. use_env Use environment variables LINES and COLUMNS. v version A bytes object representing the current version of the module. w wrapper Wrapper function that initializes curses and calls another function, restoring normal keyboard/screen behavior on error.
Python docs © Python Software Foundation · Examples CC0 ·
Source on GitHub · Not affiliated with the PSF