doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
window.clrtobot() Erase from cursor to the end of the window: all lines below the cursor are deleted, and then the equivalent of clrtoeol() is performed.
python.library.curses#curses.window.clrtobot
window.clrtoeol() Erase from cursor to the end of the line.
python.library.curses#curses.window.clrtoeol
window.cursyncup() Update the current cursor position of all the ancestors of the window to reflect the current cursor position of the window.
python.library.curses#curses.window.cursyncup
window.delch([y, x]) Delete any character at (y, x).
python.library.curses#curses.window.delch
window.deleteln() Delete the line under the cursor. All following lines are moved up by one line.
python.library.curses#curses.window.deleteln
window.derwin(begin_y, begin_x) window.derwin(nlines, ncols, begin_y, begin_x) An abbreviation for “derive window”, derwin() is the same as calling subwin(), except that begin_y and begin_x are relative to the origin of the window, rather than relative to the entire screen. Return a window object for the derived wi...
python.library.curses#curses.window.derwin
window.echochar(ch[, attr]) Add character ch with attribute attr, and immediately call refresh() on the window.
python.library.curses#curses.window.echochar
window.enclose(y, x) Test whether the given pair of screen-relative character-cell coordinates are enclosed by the given window, returning True or False. It is useful for determining what subset of the screen windows enclose the location of a mouse event.
python.library.curses#curses.window.enclose
window.encoding Encoding used to encode method arguments (Unicode strings and characters). The encoding attribute is inherited from the parent window when a subwindow is created, for example with window.subwin(). By default, the locale encoding is used (see locale.getpreferredencoding()). New in version 3.3.
python.library.curses#curses.window.encoding
window.erase() Clear the window.
python.library.curses#curses.window.erase
window.getbegyx() Return a tuple (y, x) of co-ordinates of upper-left corner.
python.library.curses#curses.window.getbegyx
window.getbkgd() Return the given window’s current background character/attribute pair.
python.library.curses#curses.window.getbkgd
window.getch([y, x]) Get a character. Note that the integer returned does not have to be in ASCII range: function keys, keypad keys and so on are represented by numbers higher than 255. In no-delay mode, return -1 if there is no input, otherwise wait until a key is pressed.
python.library.curses#curses.window.getch
window.getkey([y, x]) Get a character, returning a string instead of an integer, as getch() does. Function keys, keypad keys and other special keys return a multibyte string containing the key name. In no-delay mode, raise an exception if there is no input.
python.library.curses#curses.window.getkey
window.getmaxyx() Return a tuple (y, x) of the height and width of the window.
python.library.curses#curses.window.getmaxyx
window.getparyx() Return the beginning coordinates of this window relative to its parent window as a tuple (y, x). Return (-1, -1) if this window has no parent.
python.library.curses#curses.window.getparyx
window.getstr() window.getstr(n) window.getstr(y, x) window.getstr(y, x, n) Read a bytes object from the user, with primitive line editing capacity.
python.library.curses#curses.window.getstr
window.getyx() Return a tuple (y, x) of current cursor position relative to the window’s upper-left corner.
python.library.curses#curses.window.getyx
window.get_wch([y, x]) Get a wide character. Return a character for most keys, or an integer for function keys, keypad keys, and other special keys. In no-delay mode, raise an exception if there is no input. New in version 3.3.
python.library.curses#curses.window.get_wch
window.hline(ch, n) window.hline(y, x, ch, n) Display a horizontal line starting at (y, x) with length n consisting of the character ch.
python.library.curses#curses.window.hline
window.idcok(flag) If flag is False, curses no longer considers using the hardware insert/delete character feature of the terminal; if flag is True, use of character insertion and deletion is enabled. When curses is first initialized, use of character insert/delete is enabled by default.
python.library.curses#curses.window.idcok
window.idlok(flag) If flag is True, curses will try and use hardware line editing facilities. Otherwise, line insertion/deletion are disabled.
python.library.curses#curses.window.idlok
window.immedok(flag) If flag is True, any change in the window image automatically causes the window to be refreshed; you no longer have to call refresh() yourself. However, it may degrade performance considerably, due to repeated calls to wrefresh. This option is disabled by default.
python.library.curses#curses.window.immedok
window.inch([y, x]) Return the character at the given position in the window. The bottom 8 bits are the character proper, and upper bits are the attributes.
python.library.curses#curses.window.inch
window.insch(ch[, attr]) window.insch(y, x, ch[, attr]) Paint character ch at (y, x) with attributes attr, moving the line from position x right by one character.
python.library.curses#curses.window.insch
window.insdelln(nlines) Insert nlines lines into the specified window above the current line. The nlines bottom lines are lost. For negative nlines, delete nlines lines starting with the one under the cursor, and move the remaining lines up. The bottom nlines lines are cleared. The current cursor position remains the...
python.library.curses#curses.window.insdelln
window.insertln() Insert a blank line under the cursor. All following lines are moved down by one line.
python.library.curses#curses.window.insertln
window.insnstr(str, n[, attr]) window.insnstr(y, x, str, n[, attr]) Insert a character string (as many characters as will fit on the line) before the character under the cursor, up to n characters. If n is zero or negative, the entire string is inserted. All characters to the right of the cursor are shifted right, ...
python.library.curses#curses.window.insnstr
window.insstr(str[, attr]) window.insstr(y, x, str[, attr]) Insert a character string (as many characters as will fit on the line) before the character under the cursor. All characters to the right of the cursor are shifted right, with the rightmost characters on the line being lost. The cursor position does not ch...
python.library.curses#curses.window.insstr
window.instr([n]) window.instr(y, x[, n]) Return a bytes object of characters, extracted from the window starting at the current cursor position, or at y, x if specified. Attributes are stripped from the characters. If n is specified, instr() returns a string at most n characters long (exclusive of the trailing NUL...
python.library.curses#curses.window.instr
window.is_linetouched(line) Return True if the specified line was modified since the last call to refresh(); otherwise return False. Raise a curses.error exception if line is not valid for the given window.
python.library.curses#curses.window.is_linetouched
window.is_wintouched() Return True if the specified window was modified since the last call to refresh(); otherwise return False.
python.library.curses#curses.window.is_wintouched
window.keypad(flag) If flag is True, escape sequences generated by some keys (keypad, function keys) will be interpreted by curses. If flag is False, escape sequences will be left as is in the input stream.
python.library.curses#curses.window.keypad
window.leaveok(flag) If flag is True, cursor is left where it is on update, instead of being at “cursor position.” This reduces cursor movement where possible. If possible the cursor will be made invisible. If flag is False, cursor will always be at “cursor position” after an update.
python.library.curses#curses.window.leaveok
window.move(new_y, new_x) Move cursor to (new_y, new_x).
python.library.curses#curses.window.move
window.mvderwin(y, x) Move the window inside its parent window. The screen-relative parameters of the window are not changed. This routine is used to display different parts of the parent window at the same physical position on the screen.
python.library.curses#curses.window.mvderwin
window.mvwin(new_y, new_x) Move the window so its upper-left corner is at (new_y, new_x).
python.library.curses#curses.window.mvwin
window.nodelay(flag) If flag is True, getch() will be non-blocking.
python.library.curses#curses.window.nodelay
window.notimeout(flag) If flag is True, escape sequences will not be timed out. If flag is False, after a few milliseconds, an escape sequence will not be interpreted, and will be left in the input stream as is.
python.library.curses#curses.window.notimeout
window.noutrefresh() Mark for refresh but wait. This function updates the data structure representing the desired state of the window, but does not force an update of the physical screen. To accomplish that, call doupdate().
python.library.curses#curses.window.noutrefresh
window.overlay(destwin[, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol]) Overlay the window on top of destwin. The windows need not be the same size, only the overlapping region is copied. This copy is non-destructive, which means that the current background character does not overwrite the old contents of des...
python.library.curses#curses.window.overlay
window.overwrite(destwin[, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol]) Overwrite the window on top of destwin. The windows need not be the same size, in which case only the overlapping region is copied. This copy is destructive, which means that the current background character overwrites the old contents ...
python.library.curses#curses.window.overwrite
window.putwin(file) Write all data associated with the window into the provided file object. This information can be later retrieved using the getwin() function.
python.library.curses#curses.window.putwin
window.redrawln(beg, num) Indicate that the num screen lines, starting at line beg, are corrupted and should be completely redrawn on the next refresh() call.
python.library.curses#curses.window.redrawln
window.redrawwin() Touch the entire window, causing it to be completely redrawn on the next refresh() call.
python.library.curses#curses.window.redrawwin
window.refresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol]) Update the display immediately (sync actual screen with previous drawing/deleting methods). The 6 optional arguments can only be specified when the window is a pad created with newpad(). The additional parameters are needed to indicate what part o...
python.library.curses#curses.window.refresh
window.resize(nlines, ncols) Reallocate storage for a curses window to adjust its dimensions to the specified values. If either dimension is larger than the current values, the window’s data is filled with blanks that have the current background rendition (as set by bkgdset()) merged into them.
python.library.curses#curses.window.resize
window.scroll([lines=1]) Scroll the screen or scrolling region upward by lines lines.
python.library.curses#curses.window.scroll
window.scrollok(flag) Control what happens when the cursor of a window is moved off the edge of the window or scrolling region, either as a result of a newline action on the bottom line, or typing the last character of the last line. If flag is False, the cursor is left on the bottom line. If flag is True, the window...
python.library.curses#curses.window.scrollok
window.setscrreg(top, bottom) Set the scrolling region from line top to line bottom. All scrolling actions will take place in this region.
python.library.curses#curses.window.setscrreg
window.standend() Turn off the standout attribute. On some terminals this has the side effect of turning off all attributes.
python.library.curses#curses.window.standend
window.standout() Turn on attribute A_STANDOUT.
python.library.curses#curses.window.standout
window.subpad(begin_y, begin_x) window.subpad(nlines, ncols, begin_y, begin_x) Return a sub-window, whose upper-left corner is at (begin_y, begin_x), and whose width/height is ncols/nlines.
python.library.curses#curses.window.subpad
window.subwin(begin_y, begin_x) window.subwin(nlines, ncols, begin_y, begin_x) Return a sub-window, whose upper-left corner is at (begin_y, begin_x), and whose width/height is ncols/nlines. By default, the sub-window will extend from the specified position to the lower right corner of the window.
python.library.curses#curses.window.subwin
window.syncdown() Touch each location in the window that has been touched in any of its ancestor windows. This routine is called by refresh(), so it should almost never be necessary to call it manually.
python.library.curses#curses.window.syncdown
window.syncok(flag) If flag is True, then syncup() is called automatically whenever there is a change in the window.
python.library.curses#curses.window.syncok
window.syncup() Touch all locations in ancestors of the window that have been changed in the window.
python.library.curses#curses.window.syncup
window.timeout(delay) Set blocking or non-blocking read behavior for the window. If delay is negative, blocking read is used (which will wait indefinitely for input). If delay is zero, then non-blocking read is used, and getch() will return -1 if no input is waiting. If delay is positive, then getch() will block for ...
python.library.curses#curses.window.timeout
window.touchline(start, count[, changed]) Pretend count lines have been changed, starting with line start. If changed is supplied, it specifies whether the affected lines are marked as having been changed (changed=True) or unchanged (changed=False).
python.library.curses#curses.window.touchline
window.touchwin() Pretend the whole window has been changed, for purposes of drawing optimizations.
python.library.curses#curses.window.touchwin
window.untouchwin() Mark all lines in the window as unchanged since the last call to refresh().
python.library.curses#curses.window.untouchwin
window.vline(ch, n) window.vline(y, x, ch, n) Display a vertical line starting at (y, x) with length n consisting of the character ch.
python.library.curses#curses.window.vline
curses.wrapper(func, /, *args, **kwargs) Initialize curses and call another callable object, func, which should be the rest of your curses-using application. If the application raises an exception, this function will restore the terminal to a sane state before re-raising the exception and generating a traceback. The ...
python.library.curses#curses.wrapper
dataclasses — Data Classes Source code: Lib/dataclasses.py This module provides a decorator and functions for automatically adding generated special methods such as __init__() and __repr__() to user-defined classes. It was originally described in PEP 557. The member variables to use in these generated methods are defin...
python.library.dataclasses
dataclasses.asdict(instance, *, dict_factory=dict) Converts the dataclass instance to a dict (by using the factory function dict_factory). Each dataclass is converted to a dict of its fields, as name: value pairs. dataclasses, dicts, lists, and tuples are recursed into. For example: @dataclass class Point: x: in...
python.library.dataclasses#dataclasses.asdict
dataclasses.astuple(instance, *, tuple_factory=tuple) Converts the dataclass instance to a tuple (by using the factory function tuple_factory). Each dataclass is converted to a tuple of its field values. dataclasses, dicts, lists, and tuples are recursed into. Continuing from the previous example: assert astuple(p) =...
python.library.dataclasses#dataclasses.astuple
@dataclasses.dataclass(*, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False) This function is a decorator that is used to add generated special methods to classes, as described below. The dataclass() decorator examines the class to find fields. A field is defined as class variable that has a...
python.library.dataclasses#dataclasses.dataclass
class dataclasses.Field Field objects describe each defined field. These objects are created internally, and are returned by the fields() module-level method (see below). Users should never instantiate a Field object directly. Its documented attributes are: name: The name of the field. type: The type of the field....
python.library.dataclasses#dataclasses.Field
dataclasses.field(*, default=MISSING, default_factory=MISSING, repr=True, hash=None, init=True, compare=True, metadata=None) For common and simple use cases, no other functionality is required. There are, however, some dataclass features that require additional per-field information. To satisfy this need for addition...
python.library.dataclasses#dataclasses.field
dataclasses.fields(class_or_instance) Returns a tuple of Field objects that define the fields for this dataclass. Accepts either a dataclass, or an instance of a dataclass. Raises TypeError if not passed a dataclass or instance of one. Does not return pseudo-fields which are ClassVar or InitVar.
python.library.dataclasses#dataclasses.fields
exception dataclasses.FrozenInstanceError Raised when an implicitly defined __setattr__() or __delattr__() is called on a dataclass which was defined with frozen=True. It is a subclass of AttributeError.
python.library.dataclasses#dataclasses.FrozenInstanceError
dataclasses.is_dataclass(class_or_instance) Return True if its parameter is a dataclass or an instance of one, otherwise return False. If you need to know if a class is an instance of a dataclass (and not a dataclass itself), then add a further check for not isinstance(obj, type): def is_dataclass_instance(obj): ...
python.library.dataclasses#dataclasses.is_dataclass
dataclasses.make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False) Creates a new dataclass with name cls_name, fields as defined in fields, base classes as given in bases, and initialized with a namespace as given in namespace. fields...
python.library.dataclasses#dataclasses.make_dataclass
dataclasses.replace(instance, /, **changes) Creates a new object of the same type of instance, replacing fields with values from changes. If instance is not a Data Class, raises TypeError. If values in changes do not specify fields, raises TypeError. The newly returned object is created by calling the __init__() meth...
python.library.dataclasses#dataclasses.replace
datetime — Basic date and time types Source code: Lib/datetime.py The datetime module supplies classes for manipulating dates and times. While date and time arithmetic is supported, the focus of the implementation is on efficient attribute extraction for output formatting and manipulation. See also Module calendar ...
python.library.datetime
class datetime.date(year, month, day) All arguments are required. Arguments must be integers, in the following ranges: MINYEAR <= year <= MAXYEAR 1 <= month <= 12 1 <= day <= number of days in the given month and year If an argument outside those ranges is given, ValueError is raised.
python.library.datetime#datetime.date
date.ctime() Return a string representing the date: >>> from datetime import date >>> date(2002, 12, 4).ctime() 'Wed Dec 4 00:00:00 2002' d.ctime() is equivalent to: time.ctime(time.mktime(d.timetuple())) on platforms where the native C ctime() function (which time.ctime() invokes, but which date.ctime() does not ...
python.library.datetime#datetime.date.ctime
date.day Between 1 and the number of days in the given month of the given year.
python.library.datetime#datetime.date.day
classmethod date.fromisocalendar(year, week, day) Return a date corresponding to the ISO calendar date specified by year, week and day. This is the inverse of the function date.isocalendar(). New in version 3.8.
python.library.datetime#datetime.date.fromisocalendar
classmethod date.fromisoformat(date_string) Return a date corresponding to a date_string given in the format YYYY-MM-DD: >>> from datetime import date >>> date.fromisoformat('2019-12-04') datetime.date(2019, 12, 4) This is the inverse of date.isoformat(). It only supports the format YYYY-MM-DD. New in version 3.7.
python.library.datetime#datetime.date.fromisoformat
classmethod date.fromordinal(ordinal) Return the date corresponding to the proleptic Gregorian ordinal, where January 1 of year 1 has ordinal 1. ValueError is raised unless 1 <= ordinal <= date.max.toordinal(). For any date d, date.fromordinal(d.toordinal()) == d.
python.library.datetime#datetime.date.fromordinal
classmethod date.fromtimestamp(timestamp) Return the local date corresponding to the POSIX timestamp, such as is returned by time.time(). This may raise OverflowError, if the timestamp is out of the range of values supported by the platform C localtime() function, and OSError on localtime() failure. It’s common for t...
python.library.datetime#datetime.date.fromtimestamp
date.isocalendar() Return a named tuple object with three components: year, week and weekday. The ISO calendar is a widely used variant of the Gregorian calendar. 3 The ISO year consists of 52 or 53 full weeks, and where a week starts on a Monday and ends on a Sunday. The first week of an ISO year is the first (Grego...
python.library.datetime#datetime.date.isocalendar
date.isoformat() Return a string representing the date in ISO 8601 format, YYYY-MM-DD: >>> from datetime import date >>> date(2002, 12, 4).isoformat() '2002-12-04' This is the inverse of date.fromisoformat().
python.library.datetime#datetime.date.isoformat
date.isoweekday() Return the day of the week as an integer, where Monday is 1 and Sunday is 7. For example, date(2002, 12, 4).isoweekday() == 3, a Wednesday. See also weekday(), isocalendar().
python.library.datetime#datetime.date.isoweekday
date.max The latest representable date, date(MAXYEAR, 12, 31).
python.library.datetime#datetime.date.max
date.min The earliest representable date, date(MINYEAR, 1, 1).
python.library.datetime#datetime.date.min
date.month Between 1 and 12 inclusive.
python.library.datetime#datetime.date.month
date.replace(year=self.year, month=self.month, day=self.day) Return a date with the same value, except for those parameters given new values by whichever keyword arguments are specified. Example: >>> from datetime import date >>> d = date(2002, 12, 31) >>> d.replace(day=26) datetime.date(2002, 12, 26)
python.library.datetime#datetime.date.replace
date.resolution The smallest possible difference between non-equal date objects, timedelta(days=1).
python.library.datetime#datetime.date.resolution
date.strftime(format) Return a string representing the date, controlled by an explicit format string. Format codes referring to hours, minutes or seconds will see 0 values. For a complete list of formatting directives, see strftime() and strptime() Behavior.
python.library.datetime#datetime.date.strftime
date.timetuple() Return a time.struct_time such as returned by time.localtime(). The hours, minutes and seconds are 0, and the DST flag is -1. d.timetuple() is equivalent to: time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1)) where yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1 is ...
python.library.datetime#datetime.date.timetuple
classmethod date.today() Return the current local date. This is equivalent to date.fromtimestamp(time.time()).
python.library.datetime#datetime.date.today
date.toordinal() Return the proleptic Gregorian ordinal of the date, where January 1 of year 1 has ordinal 1. For any date object d, date.fromordinal(d.toordinal()) == d.
python.library.datetime#datetime.date.toordinal
date.weekday() Return the day of the week as an integer, where Monday is 0 and Sunday is 6. For example, date(2002, 12, 4).weekday() == 2, a Wednesday. See also isoweekday().
python.library.datetime#datetime.date.weekday
date.year Between MINYEAR and MAXYEAR inclusive.
python.library.datetime#datetime.date.year
date.__format__(format) Same as date.strftime(). This makes it possible to specify a format string for a date object in formatted string literals and when using str.format(). For a complete list of formatting directives, see strftime() and strptime() Behavior.
python.library.datetime#datetime.date.__format__
date.__str__() For a date d, str(d) is equivalent to d.isoformat().
python.library.datetime#datetime.date.__str__
class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0) The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments must be integers in the following ranges: MINYEAR <= year <= MAXYEAR, 1 <= mo...
python.library.datetime#datetime.datetime
datetime.astimezone(tz=None) Return a datetime object with new tzinfo attribute tz, adjusting the date and time data so the result is the same UTC time as self, but in tz’s local time. If provided, tz must be an instance of a tzinfo subclass, and its utcoffset() and dst() methods must not return None. If self is naiv...
python.library.datetime#datetime.datetime.astimezone