Lines Matching +full:restore +full:- +full:keys
1 .. _curses-howto:
16 module to control text-mode displays.
22 The curses library supplies a terminal-independent screen-painting and
23 keyboard-handling facility for text-based terminals; such terminals
31 true that character-cell display terminals are an obsolete technology,
33 are still valuable. One niche is on small-footprint or embedded
40 non-overlapping windows of text. The contents of a window can be
41 changed in various ways---adding text, erasing it, changing its
42 appearance---and the curses library will figure out what control codes
44 doesn't provide many user-interface concepts such as buttons, checkboxes,
51 open-source implementation of the AT&T interface. If you're using an
52 open-source Unix such as Linux or FreeBSD, your system almost certainly uses
64 ------------------------
74 This HOWTO is an introduction to writing text-mode programs with curses
94 Usually curses applications turn off automatic echoing of keys to the
95 screen, in order to be able to read keys and only display them under
101 Applications will also commonly need to react to keys instantly,
107 Terminals usually return special keys, such as the cursor keys or navigation
108 keys such as Page Up and Home, as a multibyte escape sequence. While you could
123 to reverse the curses-friendly terminal settings. Then call the
124 :func:`~curses.endwin` function to restore the terminal to its original
132 raises an uncaught exception. Keys are no longer echoed to the screen when
146 v = i-10
157 Once the callable returns, :func:`!wrapper` will restore the original
160 the state of the terminal, and then re-raises the exception. Therefore
184 Coordinates are always passed in the order *y,x*, and the top-left
194 ``(curses.LINES - 1, curses.COLS - 1)``.
201 This is because curses was originally written with slow 300-baud
221 coordinates of the on-screen area where a subsection of the pad will be
232 # (0,0) : coordinate of upper-left corner of pad area to display.
233 # (5,5) : coordinate of upper-left corner of window area to be filled
235 # (20, 75) : coordinate of lower-right corner of window area to be
278 +---------------------------------+-----------------------------------------------+
283 +---------------------------------+-----------------------------------------------+
287 +---------------------------------+-----------------------------------------------+
290 +---------------------------------+-----------------------------------------------+
293 +---------------------------------+-----------------------------------------------+
302 are sent to the terminal as-is. Strings are encoded to bytes using
310 integers greater than 255. For example, :const:`ACS_PLMINUS` is a +/-
332 --------------------
334 Characters can be displayed in different ways. Status lines in a text-based
346 +----------------------+--------------------------------------+
350 +----------------------+--------------------------------------+
352 +----------------------+--------------------------------------+
354 +----------------------+--------------------------------------+
355 | :const:`A_REVERSE` | Reverse-video text |
356 +----------------------+--------------------------------------+
358 +----------------------+--------------------------------------+
360 +----------------------+--------------------------------------+
362 So, to display a reverse-video status line on the top line of the screen, you
386 function; this can be bitwise-OR'ed with other attributes such as
397 foreground color f and background color b. Color pair 0 is hard-wired to white
431 :mod:`curses` module adds a basic text-input widget. (Other libraries
444 1-character strings, and special keys such as function keys return
450 non-blocking. To signal that no input is ready, :meth:`!getch` returns
451 ``curses.ERR`` (a value of -1) and :meth:`!getkey` raises an exception.
459 special keys such as Page Up, Home, or the cursor keys. You can compare the
474 take either integer or 1-character string arguments; these may be useful in
476 conversion functions that take either integer or 1-character-string arguments
482 functionality is quite limited; the only editing keys available are
488 # Get a 15-character string, with the cursor on the top line
492 Emacs-like set of keybindings. Various methods of the
501 stdscr.addstr(0, 0, "Enter IM message: (hit Ctrl-G to send)")
509 # Let the user edit until Ctrl-G is struck.
541 * `Writing Programs with NCURSES <https://invisible-island.net/ncurses/ncurses-intro.html>`_:
544 * `The ncurses FAQ <https://invisible-island.net/ncurses/ncurses.faq.html>`_
547 * `"Console Applications with Urwid" <https://pyvideo.org/video/1568/console-applications-with-urwi…