On this page
curses.window
Prev: curses.isendwin | Up: curses
Rel: curses.assume_default_colors, curses.baudrate, curses.beep, curses.can_change_color
Ref: docs.python.org — curses.window
Tags: #public #python3 #stdlib #curses
Import
import curses
from curses import window
Signature & Overview
curses.window()
curses.window class.
Methods & Attributes
window.addch(...)— Paint the character.window.addnstr(...)— Paint at most n characters of the string.window.addstr(...)— Paint the string.window.attroff(self, attr, /)— Remove attribute attr from the "background" set.window.attron(self, attr, /)— Add attribute attr to the "background" set.window.attrset(self, attr, /)— Set the "background" set of attributes.window.bkgd(self, ch, attr=0, /)— Set the background property of the window.window.bkgdset(self, ch, attr=0, /)— Set the window's background.window.border(...)— Draw a border around the edges of the window.window.box(...)— Draw a border around the edges of the window.window.chgat(...)— Set the attributes of characters.window.clear(self, /)— Clear the window and repaint it completely on the next refresh().window.clearok(self, flag, /)— Clear the window on the next refresh() if flag is true.window.clrtobot(self, /)— Erase from the cursor to the end of the window.window.clrtoeol(self, /)— Erase from the cursor to the end of the line.window.cursyncup(self, /)— Update the cursor position of all ancestor windows to match.window.delch(...)— Delete the character under the cursor, or at (y, x) if specified.window.deleteln(self, /)— Delete the line under the cursor; move following lines up by one.window.derwin(...)— Create a sub-window (window-relative coordinates).window.echochar(self, ch, attr=0, /)— Add character ch with attribute attr, and refresh.window.enclose(self, y, x, /)— Return True if the screen-relative coordinates are enclosed by the window.window.erase(self, /)— Clear the window.window.get_wch(...)— Get a wide character from terminal keyboard.window.getbegyx(self, /)— Return a tuple (y, x) of the upper-left corner coordinates.window.getbkgd(self, /)— Return the window's current background character/attribute pair.window.getch(...)— Get a character code from terminal keyboard.window.getkey(...)— Get a character (string) from terminal keyboard.window.getmaxyx(self, /)— Return a tuple (y, x) of the window height and width.window.getparyx(self, /)— Return (y, x) relative to the parent window, or (-1, -1) if none.window.getstr(...)— Read a string from the user, with primitive line editing capacity.window.getyx(self, /)— Return a tuple (y, x) of the current cursor position.window.hline(...)— Display a horizontal line.window.idcok(self, flag, /)— Enable or disable the hardware insert/delete character feature.window.idlok(self, flag, /)— Enable or disable the hardware insert/delete line feature.window.immedok(self, flag, /)— If flag is true, refresh the window on every change to it.window.inch(...)— Return the character at the given position in the window.window.insch(...)— Insert a character before the current or specified position.window.insdelln(self, nlines, /)— Insert (nlines > 0) or delete (nlines < 0) lines above the cursor.window.insertln(self, /)— Insert a blank line under the cursor; move following lines down.window.insnstr(...)— Insert at most n characters of the string.
Usage
import curses
# Core curses window type returned by initscr(), newwin(), and subwin()
assert hasattr(curses, "window")
Gotchas
- All coordinates are
(y, x)(row first, column second), and writing past the bottom-right corner raisescurses.error.
REPL Inspect
from curses import window
help(window)
Linked from
Related notes
- tuts/python3/stdlib_module/curses/isendwin Linked here; links to this page; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/curses/assume_default_colors Linked here; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/baudrate Linked here; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/beep Linked here; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/can_change_color Linked here; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/cbreak shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/color_content shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/color_pair shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/curs_set shared tags: #curses, #stdlib