Ncurses is a library that provides an API for advanced terminal-based, text interface designs.
Ncurses not only gives you additional options and controls not typically available in a console application, but also aims to be optimized around screen rendering time; something that can be quite slow when you render lots of small data chunks to the standard terminal.
This module provides bindings to various Ncurses functionality. See GNU.org's ncurses page for more details on what Ncurses provides.
- Global Variables
These constants may also be used in pairs, backgrounds, or attribute masks. Be warned, many of them do not work in a Windows console.
For an example of what each attribute looks like, refer to this image.
The default Ncurses window can be identified by
As you can probably imagine, this initializes the Ncurses module. By default, Ncurses is not enabled.
By calling this function, you will create the default Ncurses window (
When you are in Ncurses mode, calling this function will destroy the Ncurses environment and return you to standard output.
Prints data to an Ncurses window. The output begins at the virtual cursor's position
(use ncurses.move() to reposition the cursor) in the specified Ncurses window.
As with most Ncurses functions, you should pass
Take note that this function will not display the information immediately. The screen is only redrawn (and becomes visible) after you call ncurses.refresh().
Redraw the given window to commit any changes. Call this after a single call or batch of calls to any output function to update the screen.
Sets (or unsets) scrolling on the given window. By default, scrolling is disabled on Ncurses windows.
If you want text to scroll off the top as you continue to dump more text into it, set 'scrolling'
Erase the contents of window 'win'.
Moves the position of the virtual cursor to y,x in the given window. Notice that the orientation is Y (row) before X (column) and not the other way around. The virtual cursor position is where output will be placed in the given Ncurses window.
Should the position you request be unavailable (probably because it extends beyond the constraints of the window), this function will fail and do nothing.
Creates a new Ncurses window and returns it. 'sy' and 'sx' indicate the top-left corner of the window (in characters). 'width' and 'height' represent the window's width/height in characters.
If this function fails for any reason, it will return
Note that the position (sy,sx) is in Y,X order.
Returns the size of a window.
Note that this is in Y,X order.
Resize a Ncurses
Move a Ncurses
Note that the position is in Y,X order.
Prompt the user for some input on a Ncurses
Returns the attribute mask of a given color pair. You may call ncurses.setPair() on the pair to modify the value.
The 'pairIndex' must be in the range of 0 to 63; 0 is the default pair.
Modifies the color (foreground/background) pair at a given index.
The 'pairIndex' must be in the range of 1 to 63; 0 is reserved for the default pair.
Turns an attribute (identified by 'attrib') on for the given window.
Turns an attribute (identified by 'attrib') off for the given window.
Returns the attribute mask and color pair for a Ncurses window. If this function fails, it will
Sets the background on the given window to the attribute mask.
Page last updated at 2018-09-25 20:48:14