id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
9,100
jazzband/inflect
inflect.py
engine.compare_adjs
def compare_adjs(self, word1, word2): """ compare word1 and word2 for equality regardless of plurality word1 and word2 are to be treated as adjectives return values: eq - the strings are equal p:s - word1 is the plural of word2 s:p - word2 is the plural of word1 ...
python
def compare_adjs(self, word1, word2): """ compare word1 and word2 for equality regardless of plurality word1 and word2 are to be treated as adjectives return values: eq - the strings are equal p:s - word1 is the plural of word2 s:p - word2 is the plural of word1 ...
[ "def", "compare_adjs", "(", "self", ",", "word1", ",", "word2", ")", ":", "return", "self", ".", "_plequal", "(", "word1", ",", "word2", ",", "self", ".", "plural_adj", ")" ]
compare word1 and word2 for equality regardless of plurality word1 and word2 are to be treated as adjectives return values: eq - the strings are equal p:s - word1 is the plural of word2 s:p - word2 is the plural of word1 p:p - word1 and word2 are two different plural for...
[ "compare", "word1", "and", "word2", "for", "equality", "regardless", "of", "plurality", "word1", "and", "word2", "are", "to", "be", "treated", "as", "adjectives" ]
c2a3df74725990c195a5d7f37199de56873962e9
https://github.com/jazzband/inflect/blob/c2a3df74725990c195a5d7f37199de56873962e9/inflect.py#L2350-L2363
9,101
jazzband/inflect
inflect.py
engine.singular_noun
def singular_noun(self, text, count=None, gender=None): """ Return the singular of text, where text is a plural noun. If count supplied, then return the singular if count is one of: 1, a, an, one, each, every, this, that or if count is None otherwise return text unchanged. ...
python
def singular_noun(self, text, count=None, gender=None): """ Return the singular of text, where text is a plural noun. If count supplied, then return the singular if count is one of: 1, a, an, one, each, every, this, that or if count is None otherwise return text unchanged. ...
[ "def", "singular_noun", "(", "self", ",", "text", ",", "count", "=", "None", ",", "gender", "=", "None", ")", ":", "pre", ",", "word", ",", "post", "=", "self", ".", "partition_word", "(", "text", ")", "if", "not", "word", ":", "return", "text", "s...
Return the singular of text, where text is a plural noun. If count supplied, then return the singular if count is one of: 1, a, an, one, each, every, this, that or if count is None otherwise return text unchanged. Whitespace at the start and end is preserved.
[ "Return", "the", "singular", "of", "text", "where", "text", "is", "a", "plural", "noun", "." ]
c2a3df74725990c195a5d7f37199de56873962e9
https://github.com/jazzband/inflect/blob/c2a3df74725990c195a5d7f37199de56873962e9/inflect.py#L2365-L2385
9,102
jazzband/inflect
inflect.py
engine.a
def a(self, text, count=1): """ Return the appropriate indefinite article followed by text. The indefinite article is either 'a' or 'an'. If count is not one, then return count followed by text instead of 'a' or 'an'. Whitespace at the start and end is preserved. ...
python
def a(self, text, count=1): """ Return the appropriate indefinite article followed by text. The indefinite article is either 'a' or 'an'. If count is not one, then return count followed by text instead of 'a' or 'an'. Whitespace at the start and end is preserved. ...
[ "def", "a", "(", "self", ",", "text", ",", "count", "=", "1", ")", ":", "mo", "=", "re", ".", "search", "(", "r\"\\A(\\s*)(?:an?\\s+)?(.+?)(\\s*)\\Z\"", ",", "text", ",", "re", ".", "IGNORECASE", ")", "if", "mo", ":", "word", "=", "mo", ".", "group",...
Return the appropriate indefinite article followed by text. The indefinite article is either 'a' or 'an'. If count is not one, then return count followed by text instead of 'a' or 'an'. Whitespace at the start and end is preserved.
[ "Return", "the", "appropriate", "indefinite", "article", "followed", "by", "text", "." ]
c2a3df74725990c195a5d7f37199de56873962e9
https://github.com/jazzband/inflect/blob/c2a3df74725990c195a5d7f37199de56873962e9/inflect.py#L3259-L3280
9,103
jazzband/inflect
inflect.py
engine.no
def no(self, text, count=None): """ If count is 0, no, zero or nil, return 'no' followed by the plural of text. If count is one of: 1, a, an, one, each, every, this, that return count followed by text. Otherwise return count follow by the plural of text. ...
python
def no(self, text, count=None): """ If count is 0, no, zero or nil, return 'no' followed by the plural of text. If count is one of: 1, a, an, one, each, every, this, that return count followed by text. Otherwise return count follow by the plural of text. ...
[ "def", "no", "(", "self", ",", "text", ",", "count", "=", "None", ")", ":", "if", "count", "is", "None", "and", "self", ".", "persistent_count", "is", "not", "None", ":", "count", "=", "self", ".", "persistent_count", "if", "count", "is", "None", ":"...
If count is 0, no, zero or nil, return 'no' followed by the plural of text. If count is one of: 1, a, an, one, each, every, this, that return count followed by text. Otherwise return count follow by the plural of text. In the return value count is always followed b...
[ "If", "count", "is", "0", "no", "zero", "or", "nil", "return", "no", "followed", "by", "the", "plural", "of", "text", "." ]
c2a3df74725990c195a5d7f37199de56873962e9
https://github.com/jazzband/inflect/blob/c2a3df74725990c195a5d7f37199de56873962e9/inflect.py#L3369-L3398
9,104
jazzband/inflect
inflect.py
engine.present_participle
def present_participle(self, word): """ Return the present participle for word. word is the 3rd person singular verb. """ plv = self.plural_verb(word, 2) for pat, repl in ( (r"ie$", r"y"), (r"ue$", r"u"), # TODO: isn't ue$ -> u encompassed in t...
python
def present_participle(self, word): """ Return the present participle for word. word is the 3rd person singular verb. """ plv = self.plural_verb(word, 2) for pat, repl in ( (r"ie$", r"y"), (r"ue$", r"u"), # TODO: isn't ue$ -> u encompassed in t...
[ "def", "present_participle", "(", "self", ",", "word", ")", ":", "plv", "=", "self", ".", "plural_verb", "(", "word", ",", "2", ")", "for", "pat", ",", "repl", "in", "(", "(", "r\"ie$\"", ",", "r\"y\"", ")", ",", "(", "r\"ue$\"", ",", "r\"u\"", ")"...
Return the present participle for word. word is the 3rd person singular verb.
[ "Return", "the", "present", "participle", "for", "word", "." ]
c2a3df74725990c195a5d7f37199de56873962e9
https://github.com/jazzband/inflect/blob/c2a3df74725990c195a5d7f37199de56873962e9/inflect.py#L3402-L3427
9,105
jazzband/inflect
inflect.py
engine.ordinal
def ordinal(self, num): """ Return the ordinal of num. num can be an integer or text e.g. ordinal(1) returns '1st' ordinal('one') returns 'first' """ if re.match(r"\d", str(num)): try: num % 2 n = num exce...
python
def ordinal(self, num): """ Return the ordinal of num. num can be an integer or text e.g. ordinal(1) returns '1st' ordinal('one') returns 'first' """ if re.match(r"\d", str(num)): try: num % 2 n = num exce...
[ "def", "ordinal", "(", "self", ",", "num", ")", ":", "if", "re", ".", "match", "(", "r\"\\d\"", ",", "str", "(", "num", ")", ")", ":", "try", ":", "num", "%", "2", "n", "=", "num", "except", "TypeError", ":", "if", "\".\"", "in", "str", "(", ...
Return the ordinal of num. num can be an integer or text e.g. ordinal(1) returns '1st' ordinal('one') returns 'first'
[ "Return", "the", "ordinal", "of", "num", "." ]
c2a3df74725990c195a5d7f37199de56873962e9
https://github.com/jazzband/inflect/blob/c2a3df74725990c195a5d7f37199de56873962e9/inflect.py#L3431-L3467
9,106
jazzband/inflect
inflect.py
engine.join
def join( self, words, sep=None, sep_spaced=True, final_sep=None, conj="and", conj_spaced=True, ): """ Join words into a list. e.g. join(['ant', 'bee', 'fly']) returns 'ant, bee, and fly' options: conj: replacement for...
python
def join( self, words, sep=None, sep_spaced=True, final_sep=None, conj="and", conj_spaced=True, ): """ Join words into a list. e.g. join(['ant', 'bee', 'fly']) returns 'ant, bee, and fly' options: conj: replacement for...
[ "def", "join", "(", "self", ",", "words", ",", "sep", "=", "None", ",", "sep_spaced", "=", "True", ",", "final_sep", "=", "None", ",", "conj", "=", "\"and\"", ",", "conj_spaced", "=", "True", ",", ")", ":", "if", "not", "words", ":", "return", "\"\...
Join words into a list. e.g. join(['ant', 'bee', 'fly']) returns 'ant, bee, and fly' options: conj: replacement for 'and' sep: separator. default ',', unless ',' is in the list then ';' final_sep: final separator. default ',', unless ',' is in the list then ';' conj_spa...
[ "Join", "words", "into", "a", "list", "." ]
c2a3df74725990c195a5d7f37199de56873962e9
https://github.com/jazzband/inflect/blob/c2a3df74725990c195a5d7f37199de56873962e9/inflect.py#L3756-L3804
9,107
libtcod/python-tcod
tcod/tcod.py
_int
def _int(int_or_str: Any) -> int: "return an integer where a single character string may be expected" if isinstance(int_or_str, str): return ord(int_or_str) if isinstance(int_or_str, bytes): return int_or_str[0] return int(int_or_str)
python
def _int(int_or_str: Any) -> int: "return an integer where a single character string may be expected" if isinstance(int_or_str, str): return ord(int_or_str) if isinstance(int_or_str, bytes): return int_or_str[0] return int(int_or_str)
[ "def", "_int", "(", "int_or_str", ":", "Any", ")", "->", "int", ":", "if", "isinstance", "(", "int_or_str", ",", "str", ")", ":", "return", "ord", "(", "int_or_str", ")", "if", "isinstance", "(", "int_or_str", ",", "bytes", ")", ":", "return", "int_or_...
return an integer where a single character string may be expected
[ "return", "an", "integer", "where", "a", "single", "character", "string", "may", "be", "expected" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tcod.py#L15-L21
9,108
libtcod/python-tcod
tcod/tcod.py
_console
def _console(console: Any) -> Any: """Return a cffi console.""" try: return console.console_c except AttributeError: warnings.warn( ( "Falsy console parameters are deprecated, " "always use the root console instance returned by " "c...
python
def _console(console: Any) -> Any: """Return a cffi console.""" try: return console.console_c except AttributeError: warnings.warn( ( "Falsy console parameters are deprecated, " "always use the root console instance returned by " "c...
[ "def", "_console", "(", "console", ":", "Any", ")", "->", "Any", ":", "try", ":", "return", "console", ".", "console_c", "except", "AttributeError", ":", "warnings", ".", "warn", "(", "(", "\"Falsy console parameters are deprecated, \"", "\"always use the root conso...
Return a cffi console.
[ "Return", "a", "cffi", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tcod.py#L139-L153
9,109
libtcod/python-tcod
tcod/color.py
Color._new_from_cdata
def _new_from_cdata(cls, cdata: Any) -> "Color": """new in libtcod-cffi""" return cls(cdata.r, cdata.g, cdata.b)
python
def _new_from_cdata(cls, cdata: Any) -> "Color": """new in libtcod-cffi""" return cls(cdata.r, cdata.g, cdata.b)
[ "def", "_new_from_cdata", "(", "cls", ",", "cdata", ":", "Any", ")", "->", "\"Color\"", ":", "return", "cls", "(", "cdata", ".", "r", ",", "cdata", ".", "g", ",", "cdata", ".", "b", ")" ]
new in libtcod-cffi
[ "new", "in", "libtcod", "-", "cffi" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/color.py#L66-L68
9,110
libtcod/python-tcod
tcod/event.py
_describe_bitmask
def _describe_bitmask( bits: int, table: Dict[Any, str], default: str = "0" ) -> str: """Returns a bitmask in human readable form. This is a private function, used internally. Args: bits (int): The bitmask to be represented. table (Dict[Any,str]): A reverse lookup table. defaul...
python
def _describe_bitmask( bits: int, table: Dict[Any, str], default: str = "0" ) -> str: """Returns a bitmask in human readable form. This is a private function, used internally. Args: bits (int): The bitmask to be represented. table (Dict[Any,str]): A reverse lookup table. defaul...
[ "def", "_describe_bitmask", "(", "bits", ":", "int", ",", "table", ":", "Dict", "[", "Any", ",", "str", "]", ",", "default", ":", "str", "=", "\"0\"", ")", "->", "str", ":", "result", "=", "[", "]", "for", "bit", ",", "name", "in", "table", ".", ...
Returns a bitmask in human readable form. This is a private function, used internally. Args: bits (int): The bitmask to be represented. table (Dict[Any,str]): A reverse lookup table. default (Any): A default return value when bits is 0. Returns: str: A printable version of the bit...
[ "Returns", "a", "bitmask", "in", "human", "readable", "form", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/event.py#L25-L45
9,111
libtcod/python-tcod
tcod/event.py
_pixel_to_tile
def _pixel_to_tile(x: float, y: float) -> Tuple[float, float]: """Convert pixel coordinates to tile coordinates.""" xy = tcod.ffi.new("double[2]", (x, y)) tcod.lib.TCOD_sys_pixel_to_tile(xy, xy + 1) return xy[0], xy[1]
python
def _pixel_to_tile(x: float, y: float) -> Tuple[float, float]: """Convert pixel coordinates to tile coordinates.""" xy = tcod.ffi.new("double[2]", (x, y)) tcod.lib.TCOD_sys_pixel_to_tile(xy, xy + 1) return xy[0], xy[1]
[ "def", "_pixel_to_tile", "(", "x", ":", "float", ",", "y", ":", "float", ")", "->", "Tuple", "[", "float", ",", "float", "]", ":", "xy", "=", "tcod", ".", "ffi", ".", "new", "(", "\"double[2]\"", ",", "(", "x", ",", "y", ")", ")", "tcod", ".", ...
Convert pixel coordinates to tile coordinates.
[ "Convert", "pixel", "coordinates", "to", "tile", "coordinates", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/event.py#L48-L52
9,112
libtcod/python-tcod
tcod/event.py
get
def get() -> Iterator[Any]: """Return an iterator for all pending events. Events are processed as the iterator is consumed. Breaking out of, or discarding the iterator will leave the remaining events on the event queue. Example:: for event in tcod.event.get(): if event.type == "Q...
python
def get() -> Iterator[Any]: """Return an iterator for all pending events. Events are processed as the iterator is consumed. Breaking out of, or discarding the iterator will leave the remaining events on the event queue. Example:: for event in tcod.event.get(): if event.type == "Q...
[ "def", "get", "(", ")", "->", "Iterator", "[", "Any", "]", ":", "sdl_event", "=", "tcod", ".", "ffi", ".", "new", "(", "\"SDL_Event*\"", ")", "while", "tcod", ".", "lib", ".", "SDL_PollEvent", "(", "sdl_event", ")", ":", "if", "sdl_event", ".", "type...
Return an iterator for all pending events. Events are processed as the iterator is consumed. Breaking out of, or discarding the iterator will leave the remaining events on the event queue. Example:: for event in tcod.event.get(): if event.type == "QUIT": print(event) ...
[ "Return", "an", "iterator", "for", "all", "pending", "events", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/event.py#L564-L590
9,113
libtcod/python-tcod
tcod/event.py
wait
def wait(timeout: Optional[float] = None) -> Iterator[Any]: """Block until events exist, then return an event iterator. `timeout` is the maximum number of seconds to wait as a floating point number with millisecond precision, or it can be None to wait forever. Returns the same iterator as a call to :a...
python
def wait(timeout: Optional[float] = None) -> Iterator[Any]: """Block until events exist, then return an event iterator. `timeout` is the maximum number of seconds to wait as a floating point number with millisecond precision, or it can be None to wait forever. Returns the same iterator as a call to :a...
[ "def", "wait", "(", "timeout", ":", "Optional", "[", "float", "]", "=", "None", ")", "->", "Iterator", "[", "Any", "]", ":", "if", "timeout", "is", "not", "None", ":", "tcod", ".", "lib", ".", "SDL_WaitEventTimeout", "(", "tcod", ".", "ffi", ".", "...
Block until events exist, then return an event iterator. `timeout` is the maximum number of seconds to wait as a floating point number with millisecond precision, or it can be None to wait forever. Returns the same iterator as a call to :any:`tcod.event.get`. Example:: for event in tcod.even...
[ "Block", "until", "events", "exist", "then", "return", "an", "event", "iterator", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/event.py#L593-L620
9,114
libtcod/python-tcod
tcod/event.py
get_mouse_state
def get_mouse_state() -> MouseState: """Return the current state of the mouse. .. addedversion:: 9.3 """ xy = tcod.ffi.new("int[2]") buttons = tcod.lib.SDL_GetMouseState(xy, xy + 1) x, y = _pixel_to_tile(*xy) return MouseState((xy[0], xy[1]), (int(x), int(y)), buttons)
python
def get_mouse_state() -> MouseState: """Return the current state of the mouse. .. addedversion:: 9.3 """ xy = tcod.ffi.new("int[2]") buttons = tcod.lib.SDL_GetMouseState(xy, xy + 1) x, y = _pixel_to_tile(*xy) return MouseState((xy[0], xy[1]), (int(x), int(y)), buttons)
[ "def", "get_mouse_state", "(", ")", "->", "MouseState", ":", "xy", "=", "tcod", ".", "ffi", ".", "new", "(", "\"int[2]\"", ")", "buttons", "=", "tcod", ".", "lib", ".", "SDL_GetMouseState", "(", "xy", ",", "xy", "+", "1", ")", "x", ",", "y", "=", ...
Return the current state of the mouse. .. addedversion:: 9.3
[ "Return", "the", "current", "state", "of", "the", "mouse", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/event.py#L749-L757
9,115
libtcod/python-tcod
tcod/_internal.py
deprecate
def deprecate( message: str, category: Any = DeprecationWarning, stacklevel: int = 0 ) -> Callable[[F], F]: """Return a decorator which adds a warning to functions.""" def decorator(func: F) -> F: if not __debug__: return func @functools.wraps(func) def wrapper(*args, *...
python
def deprecate( message: str, category: Any = DeprecationWarning, stacklevel: int = 0 ) -> Callable[[F], F]: """Return a decorator which adds a warning to functions.""" def decorator(func: F) -> F: if not __debug__: return func @functools.wraps(func) def wrapper(*args, *...
[ "def", "deprecate", "(", "message", ":", "str", ",", "category", ":", "Any", "=", "DeprecationWarning", ",", "stacklevel", ":", "int", "=", "0", ")", "->", "Callable", "[", "[", "F", "]", ",", "F", "]", ":", "def", "decorator", "(", "func", ":", "F...
Return a decorator which adds a warning to functions.
[ "Return", "a", "decorator", "which", "adds", "a", "warning", "to", "functions", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/_internal.py#L9-L25
9,116
libtcod/python-tcod
tcod/_internal.py
pending_deprecate
def pending_deprecate( message: str = "This function may be deprecated in the future." " Consider raising an issue on GitHub if you need this feature.", category: Any = PendingDeprecationWarning, stacklevel: int = 0, ) -> Callable[[F], F]: """Like deprecate, but the default parameters are filled out...
python
def pending_deprecate( message: str = "This function may be deprecated in the future." " Consider raising an issue on GitHub if you need this feature.", category: Any = PendingDeprecationWarning, stacklevel: int = 0, ) -> Callable[[F], F]: """Like deprecate, but the default parameters are filled out...
[ "def", "pending_deprecate", "(", "message", ":", "str", "=", "\"This function may be deprecated in the future.\"", "\" Consider raising an issue on GitHub if you need this feature.\"", ",", "category", ":", "Any", "=", "PendingDeprecationWarning", ",", "stacklevel", ":", "int", ...
Like deprecate, but the default parameters are filled out for a generic pending deprecation warning.
[ "Like", "deprecate", "but", "the", "default", "parameters", "are", "filled", "out", "for", "a", "generic", "pending", "deprecation", "warning", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/_internal.py#L28-L36
9,117
libtcod/python-tcod
tdl/__init__.py
_format_char
def _format_char(char): """Prepares a single character for passing to ctypes calls, needs to return an integer but can also pass None which will keep the current character instead of overwriting it. This is called often and needs to be optimized whenever possible. """ if char is None: r...
python
def _format_char(char): """Prepares a single character for passing to ctypes calls, needs to return an integer but can also pass None which will keep the current character instead of overwriting it. This is called often and needs to be optimized whenever possible. """ if char is None: r...
[ "def", "_format_char", "(", "char", ")", ":", "if", "char", "is", "None", ":", "return", "-", "1", "if", "isinstance", "(", "char", ",", "_STRTYPES", ")", "and", "len", "(", "char", ")", "==", "1", ":", "return", "ord", "(", "char", ")", "try", "...
Prepares a single character for passing to ctypes calls, needs to return an integer but can also pass None which will keep the current character instead of overwriting it. This is called often and needs to be optimized whenever possible.
[ "Prepares", "a", "single", "character", "for", "passing", "to", "ctypes", "calls", "needs", "to", "return", "an", "integer", "but", "can", "also", "pass", "None", "which", "will", "keep", "the", "current", "character", "instead", "of", "overwriting", "it", "...
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L101-L115
9,118
libtcod/python-tcod
tdl/__init__.py
_format_str
def _format_str(string): """Attempt fast string handing by decoding directly into an array.""" if isinstance(string, _STRTYPES): if _IS_PYTHON3: array = _array.array('I') array.frombytes(string.encode(_utf32_codec)) else: # Python 2 if isinstance(string, unico...
python
def _format_str(string): """Attempt fast string handing by decoding directly into an array.""" if isinstance(string, _STRTYPES): if _IS_PYTHON3: array = _array.array('I') array.frombytes(string.encode(_utf32_codec)) else: # Python 2 if isinstance(string, unico...
[ "def", "_format_str", "(", "string", ")", ":", "if", "isinstance", "(", "string", ",", "_STRTYPES", ")", ":", "if", "_IS_PYTHON3", ":", "array", "=", "_array", ".", "array", "(", "'I'", ")", "array", ".", "frombytes", "(", "string", ".", "encode", "(",...
Attempt fast string handing by decoding directly into an array.
[ "Attempt", "fast", "string", "handing", "by", "decoding", "directly", "into", "an", "array", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L119-L133
9,119
libtcod/python-tcod
tdl/__init__.py
_getImageSize
def _getImageSize(filename): """Try to get the width and height of a bmp of png image file""" result = None file = open(filename, 'rb') if file.read(8) == b'\x89PNG\r\n\x1a\n': # PNG while 1: length, = _struct.unpack('>i', file.read(4)) chunkID = file.read(4) ...
python
def _getImageSize(filename): """Try to get the width and height of a bmp of png image file""" result = None file = open(filename, 'rb') if file.read(8) == b'\x89PNG\r\n\x1a\n': # PNG while 1: length, = _struct.unpack('>i', file.read(4)) chunkID = file.read(4) ...
[ "def", "_getImageSize", "(", "filename", ")", ":", "result", "=", "None", "file", "=", "open", "(", "filename", ",", "'rb'", ")", "if", "file", ".", "read", "(", "8", ")", "==", "b'\\x89PNG\\r\\n\\x1a\\n'", ":", "# PNG", "while", "1", ":", "length", ",...
Try to get the width and height of a bmp of png image file
[ "Try", "to", "get", "the", "width", "and", "height", "of", "a", "bmp", "of", "png", "image", "file" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L165-L187
9,120
libtcod/python-tcod
tdl/__init__.py
init
def init(width, height, title=None, fullscreen=False, renderer='SDL'): """Start the main console with the given width and height and return the root console. Call the consoles drawing functions. Then remember to use L{tdl.flush} to make what's drawn visible on the console. Args: width (in...
python
def init(width, height, title=None, fullscreen=False, renderer='SDL'): """Start the main console with the given width and height and return the root console. Call the consoles drawing functions. Then remember to use L{tdl.flush} to make what's drawn visible on the console. Args: width (in...
[ "def", "init", "(", "width", ",", "height", ",", "title", "=", "None", ",", "fullscreen", "=", "False", ",", "renderer", "=", "'SDL'", ")", ":", "RENDERERS", "=", "{", "'GLSL'", ":", "0", ",", "'OPENGL'", ":", "1", ",", "'SDL'", ":", "2", "}", "g...
Start the main console with the given width and height and return the root console. Call the consoles drawing functions. Then remember to use L{tdl.flush} to make what's drawn visible on the console. Args: width (int): width of the root console (in tiles) height (int): height of the r...
[ "Start", "the", "main", "console", "with", "the", "given", "width", "and", "height", "and", "return", "the", "root", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L1014-L1080
9,121
libtcod/python-tcod
tdl/__init__.py
screenshot
def screenshot(path=None): """Capture the screen and save it as a png file. If path is None then the image will be placed in the current folder with the names: ``screenshot001.png, screenshot002.png, ...`` Args: path (Optional[Text]): The file path to save the screenshot. """ if no...
python
def screenshot(path=None): """Capture the screen and save it as a png file. If path is None then the image will be placed in the current folder with the names: ``screenshot001.png, screenshot002.png, ...`` Args: path (Optional[Text]): The file path to save the screenshot. """ if no...
[ "def", "screenshot", "(", "path", "=", "None", ")", ":", "if", "not", "_rootinitialized", ":", "raise", "TDLError", "(", "'Initialize first with tdl.init'", ")", "if", "isinstance", "(", "path", ",", "str", ")", ":", "_lib", ".", "TCOD_sys_save_screenshot", "(...
Capture the screen and save it as a png file. If path is None then the image will be placed in the current folder with the names: ``screenshot001.png, screenshot002.png, ...`` Args: path (Optional[Text]): The file path to save the screenshot.
[ "Capture", "the", "screen", "and", "save", "it", "as", "a", "png", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L1243-L1271
9,122
libtcod/python-tcod
tdl/__init__.py
_BaseConsole._normalizePoint
def _normalizePoint(self, x, y): """Check if a point is in bounds and make minor adjustments. Respects Pythons negative indexes. -1 starts at the bottom right. Replaces the _drawable function """ # cast to int, always faster than type checking x = int(x) y = int...
python
def _normalizePoint(self, x, y): """Check if a point is in bounds and make minor adjustments. Respects Pythons negative indexes. -1 starts at the bottom right. Replaces the _drawable function """ # cast to int, always faster than type checking x = int(x) y = int...
[ "def", "_normalizePoint", "(", "self", ",", "x", ",", "y", ")", ":", "# cast to int, always faster than type checking", "x", "=", "int", "(", "x", ")", "y", "=", "int", "(", "y", ")", "assert", "(", "-", "self", ".", "width", "<=", "x", "<", "self", ...
Check if a point is in bounds and make minor adjustments. Respects Pythons negative indexes. -1 starts at the bottom right. Replaces the _drawable function
[ "Check", "if", "a", "point", "is", "in", "bounds", "and", "make", "minor", "adjustments", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L208-L223
9,123
libtcod/python-tcod
tdl/__init__.py
_BaseConsole._normalizeRect
def _normalizeRect(self, x, y, width, height): """Check if the rectangle is in bounds and make minor adjustments. raise AssertionError's for any problems """ x, y = self._normalizePoint(x, y) # inherit _normalizePoint logic assert width is None or isinstance(width, _INTTYPES), '...
python
def _normalizeRect(self, x, y, width, height): """Check if the rectangle is in bounds and make minor adjustments. raise AssertionError's for any problems """ x, y = self._normalizePoint(x, y) # inherit _normalizePoint logic assert width is None or isinstance(width, _INTTYPES), '...
[ "def", "_normalizeRect", "(", "self", ",", "x", ",", "y", ",", "width", ",", "height", ")", ":", "x", ",", "y", "=", "self", ".", "_normalizePoint", "(", "x", ",", "y", ")", "# inherit _normalizePoint logic", "assert", "width", "is", "None", "or", "isi...
Check if the rectangle is in bounds and make minor adjustments. raise AssertionError's for any problems
[ "Check", "if", "the", "rectangle", "is", "in", "bounds", "and", "make", "minor", "adjustments", ".", "raise", "AssertionError", "s", "for", "any", "problems" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L225-L250
9,124
libtcod/python-tcod
tdl/__init__.py
_BaseConsole._normalizeCursor
def _normalizeCursor(self, x, y): """return the normalized the cursor position.""" width, height = self.get_size() assert width != 0 and height != 0, 'can not print on a console with a width or height of zero' while x >= width: x -= width y += 1 while y >=...
python
def _normalizeCursor(self, x, y): """return the normalized the cursor position.""" width, height = self.get_size() assert width != 0 and height != 0, 'can not print on a console with a width or height of zero' while x >= width: x -= width y += 1 while y >=...
[ "def", "_normalizeCursor", "(", "self", ",", "x", ",", "y", ")", ":", "width", ",", "height", "=", "self", ".", "get_size", "(", ")", "assert", "width", "!=", "0", "and", "height", "!=", "0", ",", "'can not print on a console with a width or height of zero'", ...
return the normalized the cursor position.
[ "return", "the", "normalized", "the", "cursor", "position", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L252-L267
9,125
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.set_mode
def set_mode(self, mode): """Configure how this console will react to the cursor writing past the end if the console. This is for methods that use the virtual cursor, such as :any:`print_str`. Args: mode (Text): The mode to set. Possible settings are: ...
python
def set_mode(self, mode): """Configure how this console will react to the cursor writing past the end if the console. This is for methods that use the virtual cursor, such as :any:`print_str`. Args: mode (Text): The mode to set. Possible settings are: ...
[ "def", "set_mode", "(", "self", ",", "mode", ")", ":", "MODES", "=", "[", "'error'", ",", "'scroll'", "]", "if", "mode", ".", "lower", "(", ")", "not", "in", "MODES", ":", "raise", "TDLError", "(", "'mode must be one of %s, got %s'", "%", "(", "MODES", ...
Configure how this console will react to the cursor writing past the end if the console. This is for methods that use the virtual cursor, such as :any:`print_str`. Args: mode (Text): The mode to set. Possible settings are: - 'error' - A TDLError wil...
[ "Configure", "how", "this", "console", "will", "react", "to", "the", "cursor", "writing", "past", "the", "end", "if", "the", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L269-L295
9,126
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.print_str
def print_str(self, string): """Print a string at the virtual cursor. Handles special characters such as '\\n' and '\\r'. Printing past the bottom of the console will scroll everything upwards if :any:`set_mode` is set to 'scroll'. Colors can be set with :any:`set_colors` and t...
python
def print_str(self, string): """Print a string at the virtual cursor. Handles special characters such as '\\n' and '\\r'. Printing past the bottom of the console will scroll everything upwards if :any:`set_mode` is set to 'scroll'. Colors can be set with :any:`set_colors` and t...
[ "def", "print_str", "(", "self", ",", "string", ")", ":", "x", ",", "y", "=", "self", ".", "_cursor", "for", "char", "in", "string", ":", "if", "char", "==", "'\\n'", ":", "# line break", "x", "=", "0", "y", "+=", "1", "continue", "if", "char", "...
Print a string at the virtual cursor. Handles special characters such as '\\n' and '\\r'. Printing past the bottom of the console will scroll everything upwards if :any:`set_mode` is set to 'scroll'. Colors can be set with :any:`set_colors` and the virtual cursor can be moved w...
[ "Print", "a", "string", "at", "the", "virtual", "cursor", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L312-L340
9,127
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.write
def write(self, string): """This method mimics basic file-like behaviour. Because of this method you can replace sys.stdout or sys.stderr with a :any:`Console` or :any:`Window` instance. This is a convoluted process and behaviour seen now can be excepted to change on later vers...
python
def write(self, string): """This method mimics basic file-like behaviour. Because of this method you can replace sys.stdout or sys.stderr with a :any:`Console` or :any:`Window` instance. This is a convoluted process and behaviour seen now can be excepted to change on later vers...
[ "def", "write", "(", "self", ",", "string", ")", ":", "# some 'basic' line buffer stuff.", "# there must be an easier way to do this. The textwrap module didn't", "# help much.", "x", ",", "y", "=", "self", ".", "_normalizeCursor", "(", "*", "self", ".", "_cursor", ")"...
This method mimics basic file-like behaviour. Because of this method you can replace sys.stdout or sys.stderr with a :any:`Console` or :any:`Window` instance. This is a convoluted process and behaviour seen now can be excepted to change on later versions. Args: str...
[ "This", "method", "mimics", "basic", "file", "-", "like", "behaviour", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L342-L376
9,128
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.draw_char
def draw_char(self, x, y, char, fg=Ellipsis, bg=Ellipsis): """Draws a single character. Args: x (int): x-coordinate to draw on. y (int): y-coordinate to draw on. char (Optional[Union[int, Text]]): An integer, single character string, or None. ...
python
def draw_char(self, x, y, char, fg=Ellipsis, bg=Ellipsis): """Draws a single character. Args: x (int): x-coordinate to draw on. y (int): y-coordinate to draw on. char (Optional[Union[int, Text]]): An integer, single character string, or None. ...
[ "def", "draw_char", "(", "self", ",", "x", ",", "y", ",", "char", ",", "fg", "=", "Ellipsis", ",", "bg", "=", "Ellipsis", ")", ":", "#x, y = self._normalizePoint(x, y)", "_put_char_ex", "(", "self", ".", "console_c", ",", "x", ",", "y", ",", "_format_cha...
Draws a single character. Args: x (int): x-coordinate to draw on. y (int): y-coordinate to draw on. char (Optional[Union[int, Text]]): An integer, single character string, or None. You can set the char parameter as None if you only want to ch...
[ "Draws", "a", "single", "character", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L378-L401
9,129
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.draw_str
def draw_str(self, x, y, string, fg=Ellipsis, bg=Ellipsis): """Draws a string starting at x and y. A string that goes past the right side will wrap around. A string wrapping to below the console will raise :any:`tdl.TDLError` but will still be written out. This means you can sa...
python
def draw_str(self, x, y, string, fg=Ellipsis, bg=Ellipsis): """Draws a string starting at x and y. A string that goes past the right side will wrap around. A string wrapping to below the console will raise :any:`tdl.TDLError` but will still be written out. This means you can sa...
[ "def", "draw_str", "(", "self", ",", "x", ",", "y", ",", "string", ",", "fg", "=", "Ellipsis", ",", "bg", "=", "Ellipsis", ")", ":", "x", ",", "y", "=", "self", ".", "_normalizePoint", "(", "x", ",", "y", ")", "fg", ",", "bg", "=", "_format_col...
Draws a string starting at x and y. A string that goes past the right side will wrap around. A string wrapping to below the console will raise :any:`tdl.TDLError` but will still be written out. This means you can safely ignore the errors with a try..except block if you're fine ...
[ "Draws", "a", "string", "starting", "at", "x", "and", "y", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L403-L457
9,130
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.draw_rect
def draw_rect(self, x, y, width, height, string, fg=Ellipsis, bg=Ellipsis): """Draws a rectangle starting from x and y and extending to width and height. If width or height are None then it will extend to the edge of the console. Args: x (int): x-coordinate for the top side of the ...
python
def draw_rect(self, x, y, width, height, string, fg=Ellipsis, bg=Ellipsis): """Draws a rectangle starting from x and y and extending to width and height. If width or height are None then it will extend to the edge of the console. Args: x (int): x-coordinate for the top side of the ...
[ "def", "draw_rect", "(", "self", ",", "x", ",", "y", ",", "width", ",", "height", ",", "string", ",", "fg", "=", "Ellipsis", ",", "bg", "=", "Ellipsis", ")", ":", "x", ",", "y", ",", "width", ",", "height", "=", "self", ".", "_normalizeRect", "("...
Draws a rectangle starting from x and y and extending to width and height. If width or height are None then it will extend to the edge of the console. Args: x (int): x-coordinate for the top side of the rect. y (int): y-coordinate for the left side of the rect. widt...
[ "Draws", "a", "rectangle", "starting", "from", "x", "and", "y", "and", "extending", "to", "width", "and", "height", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L459-L500
9,131
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.blit
def blit(self, source, x=0, y=0, width=None, height=None, srcX=0, srcY=0, fg_alpha=1.0, bg_alpha=1.0): """Blit another console or Window onto the current console. By default it blits the entire source to the topleft corner. Args: source (Union[tdl.Console, tdl.Window])...
python
def blit(self, source, x=0, y=0, width=None, height=None, srcX=0, srcY=0, fg_alpha=1.0, bg_alpha=1.0): """Blit another console or Window onto the current console. By default it blits the entire source to the topleft corner. Args: source (Union[tdl.Console, tdl.Window])...
[ "def", "blit", "(", "self", ",", "source", ",", "x", "=", "0", ",", "y", "=", "0", ",", "width", "=", "None", ",", "height", "=", "None", ",", "srcX", "=", "0", ",", "srcY", "=", "0", ",", "fg_alpha", "=", "1.0", ",", "bg_alpha", "=", "1.0", ...
Blit another console or Window onto the current console. By default it blits the entire source to the topleft corner. Args: source (Union[tdl.Console, tdl.Window]): The blitting source. A console can blit to itself without any problems. x (int): x-coordinate of ...
[ "Blit", "another", "console", "or", "Window", "onto", "the", "current", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L542-L591
9,132
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.get_cursor
def get_cursor(self): """Return the virtual cursor position. The cursor can be moved with the :any:`move` method. Returns: Tuple[int, int]: The (x, y) coordinate of where :any:`print_str` will continue from. .. seealso:: :any:move` """ x, y ...
python
def get_cursor(self): """Return the virtual cursor position. The cursor can be moved with the :any:`move` method. Returns: Tuple[int, int]: The (x, y) coordinate of where :any:`print_str` will continue from. .. seealso:: :any:move` """ x, y ...
[ "def", "get_cursor", "(", "self", ")", ":", "x", ",", "y", "=", "self", ".", "_cursor", "width", ",", "height", "=", "self", ".", "parent", ".", "get_size", "(", ")", "while", "x", ">=", "width", ":", "x", "-=", "width", "y", "+=", "1", "if", "...
Return the virtual cursor position. The cursor can be moved with the :any:`move` method. Returns: Tuple[int, int]: The (x, y) coordinate of where :any:`print_str` will continue from. .. seealso:: :any:move`
[ "Return", "the", "virtual", "cursor", "position", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L593-L611
9,133
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.move
def move(self, x, y): """Move the virtual cursor. Args: x (int): x-coordinate to place the cursor. y (int): y-coordinate to place the cursor. .. seealso:: :any:`get_cursor`, :any:`print_str`, :any:`write` """ self._cursor = self._normalizePoint(x, y)
python
def move(self, x, y): """Move the virtual cursor. Args: x (int): x-coordinate to place the cursor. y (int): y-coordinate to place the cursor. .. seealso:: :any:`get_cursor`, :any:`print_str`, :any:`write` """ self._cursor = self._normalizePoint(x, y)
[ "def", "move", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "_cursor", "=", "self", ".", "_normalizePoint", "(", "x", ",", "y", ")" ]
Move the virtual cursor. Args: x (int): x-coordinate to place the cursor. y (int): y-coordinate to place the cursor. .. seealso:: :any:`get_cursor`, :any:`print_str`, :any:`write`
[ "Move", "the", "virtual", "cursor", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L632-L641
9,134
libtcod/python-tcod
tdl/__init__.py
_BaseConsole.scroll
def scroll(self, x, y): """Scroll the contents of the console in the direction of x,y. Uncovered areas will be cleared to the default background color. Does not move the virutal cursor. Args: x (int): Distance to scroll along the x-axis. y (int): Distance to scr...
python
def scroll(self, x, y): """Scroll the contents of the console in the direction of x,y. Uncovered areas will be cleared to the default background color. Does not move the virutal cursor. Args: x (int): Distance to scroll along the x-axis. y (int): Distance to scr...
[ "def", "scroll", "(", "self", ",", "x", ",", "y", ")", ":", "assert", "isinstance", "(", "x", ",", "_INTTYPES", ")", ",", "\"x must be an integer, got %s\"", "%", "repr", "(", "x", ")", "assert", "isinstance", "(", "y", ",", "_INTTYPES", ")", ",", "\"y...
Scroll the contents of the console in the direction of x,y. Uncovered areas will be cleared to the default background color. Does not move the virutal cursor. Args: x (int): Distance to scroll along the x-axis. y (int): Distance to scroll along the y-axis. Retu...
[ "Scroll", "the", "contents", "of", "the", "console", "in", "the", "direction", "of", "x", "y", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L643-L714
9,135
libtcod/python-tcod
tdl/__init__.py
Console._newConsole
def _newConsole(cls, console): """Make a Console instance, from a console ctype""" self = cls.__new__(cls) _BaseConsole.__init__(self) self.console_c = console self.console = self self.width = _lib.TCOD_console_get_width(console) self.height = _lib.TCOD_console_ge...
python
def _newConsole(cls, console): """Make a Console instance, from a console ctype""" self = cls.__new__(cls) _BaseConsole.__init__(self) self.console_c = console self.console = self self.width = _lib.TCOD_console_get_width(console) self.height = _lib.TCOD_console_ge...
[ "def", "_newConsole", "(", "cls", ",", "console", ")", ":", "self", "=", "cls", ".", "__new__", "(", "cls", ")", "_BaseConsole", ".", "__init__", "(", "self", ")", "self", ".", "console_c", "=", "console", "self", ".", "console", "=", "self", "self", ...
Make a Console instance, from a console ctype
[ "Make", "a", "Console", "instance", "from", "a", "console", "ctype" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L787-L795
9,136
libtcod/python-tcod
tdl/__init__.py
Console._root_unhook
def _root_unhook(self): """Change this root console into a normal Console object and delete the root console from TCOD """ global _rootinitialized, _rootConsoleRef # do we recognise this as the root console? # if not then assume the console has already been taken care of ...
python
def _root_unhook(self): """Change this root console into a normal Console object and delete the root console from TCOD """ global _rootinitialized, _rootConsoleRef # do we recognise this as the root console? # if not then assume the console has already been taken care of ...
[ "def", "_root_unhook", "(", "self", ")", ":", "global", "_rootinitialized", ",", "_rootConsoleRef", "# do we recognise this as the root console?", "# if not then assume the console has already been taken care of", "if", "(", "_rootConsoleRef", "and", "_rootConsoleRef", "(", ")", ...
Change this root console into a normal Console object and delete the root console from TCOD
[ "Change", "this", "root", "console", "into", "a", "normal", "Console", "object", "and", "delete", "the", "root", "console", "from", "TCOD" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L797-L815
9,137
libtcod/python-tcod
tdl/__init__.py
Console._set_char
def _set_char(self, x, y, char, fg=None, bg=None, bgblend=_lib.TCOD_BKGND_SET): """ Sets a character. This is called often and is designed to be as fast as possible. Because of the need for speed this function will do NO TYPE CHECKING AT ALL, it's up to the dra...
python
def _set_char(self, x, y, char, fg=None, bg=None, bgblend=_lib.TCOD_BKGND_SET): """ Sets a character. This is called often and is designed to be as fast as possible. Because of the need for speed this function will do NO TYPE CHECKING AT ALL, it's up to the dra...
[ "def", "_set_char", "(", "self", ",", "x", ",", "y", ",", "char", ",", "fg", "=", "None", ",", "bg", "=", "None", ",", "bgblend", "=", "_lib", ".", "TCOD_BKGND_SET", ")", ":", "# values are already formatted, honestly this function is redundant", "return", "_p...
Sets a character. This is called often and is designed to be as fast as possible. Because of the need for speed this function will do NO TYPE CHECKING AT ALL, it's up to the drawing functions to use the functions: _format_char and _format_color before passing to this.
[ "Sets", "a", "character", ".", "This", "is", "called", "often", "and", "is", "designed", "to", "be", "as", "fast", "as", "possible", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L871-L881
9,138
libtcod/python-tcod
tdl/__init__.py
Console._set_batch
def _set_batch(self, batch, fg, bg, bgblend=1, nullChar=False): """ Try to perform a batch operation otherwise fall back to _set_char. If fg and bg are defined then this is faster but not by very much. if any character is None then nullChar is True batch is a iterable o...
python
def _set_batch(self, batch, fg, bg, bgblend=1, nullChar=False): """ Try to perform a batch operation otherwise fall back to _set_char. If fg and bg are defined then this is faster but not by very much. if any character is None then nullChar is True batch is a iterable o...
[ "def", "_set_batch", "(", "self", ",", "batch", ",", "fg", ",", "bg", ",", "bgblend", "=", "1", ",", "nullChar", "=", "False", ")", ":", "for", "(", "x", ",", "y", ")", ",", "char", "in", "batch", ":", "self", ".", "_set_char", "(", "x", ",", ...
Try to perform a batch operation otherwise fall back to _set_char. If fg and bg are defined then this is faster but not by very much. if any character is None then nullChar is True batch is a iterable of [(x, y), ch] items
[ "Try", "to", "perform", "a", "batch", "operation", "otherwise", "fall", "back", "to", "_set_char", ".", "If", "fg", "and", "bg", "are", "defined", "then", "this", "is", "faster", "but", "not", "by", "very", "much", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L883-L894
9,139
libtcod/python-tcod
tdl/__init__.py
Window._translate
def _translate(self, x, y): """Convertion x and y to their position on the root Console""" # we add our position relative to our parent and then call then next parent up return self.parent._translate((x + self.x), (y + self.y))
python
def _translate(self, x, y): """Convertion x and y to their position on the root Console""" # we add our position relative to our parent and then call then next parent up return self.parent._translate((x + self.x), (y + self.y))
[ "def", "_translate", "(", "self", ",", "x", ",", "y", ")", ":", "# we add our position relative to our parent and then call then next parent up", "return", "self", ".", "parent", ".", "_translate", "(", "(", "x", "+", "self", ".", "x", ")", ",", "(", "y", "+",...
Convertion x and y to their position on the root Console
[ "Convertion", "x", "and", "y", "to", "their", "position", "on", "the", "root", "Console" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L948-L951
9,140
libtcod/python-tcod
tcod/path.py
_pycall_path_old
def _pycall_path_old(x1: int, y1: int, x2: int, y2: int, handle: Any) -> float: """libtcodpy style callback, needs to preserve the old userData issue.""" func, userData = ffi.from_handle(handle) return func(x1, y1, x2, y2, userData)
python
def _pycall_path_old(x1: int, y1: int, x2: int, y2: int, handle: Any) -> float: """libtcodpy style callback, needs to preserve the old userData issue.""" func, userData = ffi.from_handle(handle) return func(x1, y1, x2, y2, userData)
[ "def", "_pycall_path_old", "(", "x1", ":", "int", ",", "y1", ":", "int", ",", "x2", ":", "int", ",", "y2", ":", "int", ",", "handle", ":", "Any", ")", "->", "float", ":", "func", ",", "userData", "=", "ffi", ".", "from_handle", "(", "handle", ")"...
libtcodpy style callback, needs to preserve the old userData issue.
[ "libtcodpy", "style", "callback", "needs", "to", "preserve", "the", "old", "userData", "issue", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/path.py#L52-L55
9,141
libtcod/python-tcod
tcod/path.py
_pycall_path_simple
def _pycall_path_simple( x1: int, y1: int, x2: int, y2: int, handle: Any ) -> float: """Does less and should run faster, just calls the handle function.""" return ffi.from_handle(handle)(x1, y1, x2, y2)
python
def _pycall_path_simple( x1: int, y1: int, x2: int, y2: int, handle: Any ) -> float: """Does less and should run faster, just calls the handle function.""" return ffi.from_handle(handle)(x1, y1, x2, y2)
[ "def", "_pycall_path_simple", "(", "x1", ":", "int", ",", "y1", ":", "int", ",", "x2", ":", "int", ",", "y2", ":", "int", ",", "handle", ":", "Any", ")", "->", "float", ":", "return", "ffi", ".", "from_handle", "(", "handle", ")", "(", "x1", ",",...
Does less and should run faster, just calls the handle function.
[ "Does", "less", "and", "should", "run", "faster", "just", "calls", "the", "handle", "function", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/path.py#L59-L63
9,142
libtcod/python-tcod
tcod/path.py
_get_pathcost_func
def _get_pathcost_func( name: str ) -> Callable[[int, int, int, int, Any], float]: """Return a properly cast PathCostArray callback.""" return ffi.cast( # type: ignore "TCOD_path_func_t", ffi.addressof(lib, name) )
python
def _get_pathcost_func( name: str ) -> Callable[[int, int, int, int, Any], float]: """Return a properly cast PathCostArray callback.""" return ffi.cast( # type: ignore "TCOD_path_func_t", ffi.addressof(lib, name) )
[ "def", "_get_pathcost_func", "(", "name", ":", "str", ")", "->", "Callable", "[", "[", "int", ",", "int", ",", "int", ",", "int", ",", "Any", "]", ",", "float", "]", ":", "return", "ffi", ".", "cast", "(", "# type: ignore", "\"TCOD_path_func_t\"", ",",...
Return a properly cast PathCostArray callback.
[ "Return", "a", "properly", "cast", "PathCostArray", "callback", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/path.py#L82-L88
9,143
libtcod/python-tcod
tcod/path.py
Dijkstra.set_goal
def set_goal(self, x: int, y: int) -> None: """Set the goal point and recompute the Dijkstra path-finder. """ lib.TCOD_dijkstra_compute(self._path_c, x, y)
python
def set_goal(self, x: int, y: int) -> None: """Set the goal point and recompute the Dijkstra path-finder. """ lib.TCOD_dijkstra_compute(self._path_c, x, y)
[ "def", "set_goal", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_dijkstra_compute", "(", "self", ".", "_path_c", ",", "x", ",", "y", ")" ]
Set the goal point and recompute the Dijkstra path-finder.
[ "Set", "the", "goal", "point", "and", "recompute", "the", "Dijkstra", "path", "-", "finder", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/path.py#L294-L297
9,144
libtcod/python-tcod
examples/termbox/termbox.py
Termbox.poll_event
def poll_event(self): """Wait for an event and return it. Returns a tuple: (type, unicode character, key, mod, width, height, mousex, mousey). """ """ cdef tb_event e with self._poll_lock: with nogil: result = tb_poll_event(&e) ...
python
def poll_event(self): """Wait for an event and return it. Returns a tuple: (type, unicode character, key, mod, width, height, mousex, mousey). """ """ cdef tb_event e with self._poll_lock: with nogil: result = tb_poll_event(&e) ...
[ "def", "poll_event", "(", "self", ")", ":", "\"\"\"\n cdef tb_event e\n with self._poll_lock:\n with nogil:\n result = tb_poll_event(&e)\n assert(result >= 0)\n if e.ch:\n uch = unichr(e.ch)\n else:\n uch = None\n ...
Wait for an event and return it. Returns a tuple: (type, unicode character, key, mod, width, height, mousex, mousey).
[ "Wait", "for", "an", "event", "and", "return", "it", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/examples/termbox/termbox.py#L271-L293
9,145
libtcod/python-tcod
tcod/random.py
Random._new_from_cdata
def _new_from_cdata(cls, cdata: Any) -> "Random": """Return a new instance encapsulating this cdata.""" self = object.__new__(cls) # type: "Random" self.random_c = cdata return self
python
def _new_from_cdata(cls, cdata: Any) -> "Random": """Return a new instance encapsulating this cdata.""" self = object.__new__(cls) # type: "Random" self.random_c = cdata return self
[ "def", "_new_from_cdata", "(", "cls", ",", "cdata", ":", "Any", ")", "->", "\"Random\"", ":", "self", "=", "object", ".", "__new__", "(", "cls", ")", "# type: \"Random\"", "self", ".", "random_c", "=", "cdata", "return", "self" ]
Return a new instance encapsulating this cdata.
[ "Return", "a", "new", "instance", "encapsulating", "this", "cdata", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/random.py#L58-L62
9,146
libtcod/python-tcod
tcod/random.py
Random.guass
def guass(self, mu: float, sigma: float) -> float: """Return a random number using Gaussian distribution. Args: mu (float): The median returned value. sigma (float): The standard deviation. Returns: float: A random float. """ return float( ...
python
def guass(self, mu: float, sigma: float) -> float: """Return a random number using Gaussian distribution. Args: mu (float): The median returned value. sigma (float): The standard deviation. Returns: float: A random float. """ return float( ...
[ "def", "guass", "(", "self", ",", "mu", ":", "float", ",", "sigma", ":", "float", ")", "->", "float", ":", "return", "float", "(", "lib", ".", "TCOD_random_get_gaussian_double", "(", "self", ".", "random_c", ",", "mu", ",", "sigma", ")", ")" ]
Return a random number using Gaussian distribution. Args: mu (float): The median returned value. sigma (float): The standard deviation. Returns: float: A random float.
[ "Return", "a", "random", "number", "using", "Gaussian", "distribution", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/random.py#L88-L100
9,147
libtcod/python-tcod
tcod/random.py
Random.inverse_guass
def inverse_guass(self, mu: float, sigma: float) -> float: """Return a random Gaussian number using the Box-Muller transform. Args: mu (float): The median returned value. sigma (float): The standard deviation. Returns: float: A random float. """ ...
python
def inverse_guass(self, mu: float, sigma: float) -> float: """Return a random Gaussian number using the Box-Muller transform. Args: mu (float): The median returned value. sigma (float): The standard deviation. Returns: float: A random float. """ ...
[ "def", "inverse_guass", "(", "self", ",", "mu", ":", "float", ",", "sigma", ":", "float", ")", "->", "float", ":", "return", "float", "(", "lib", ".", "TCOD_random_get_gaussian_double_inv", "(", "self", ".", "random_c", ",", "mu", ",", "sigma", ")", ")" ...
Return a random Gaussian number using the Box-Muller transform. Args: mu (float): The median returned value. sigma (float): The standard deviation. Returns: float: A random float.
[ "Return", "a", "random", "Gaussian", "number", "using", "the", "Box", "-", "Muller", "transform", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/random.py#L102-L114
9,148
libtcod/python-tcod
tdl/noise.py
Noise.get_point
def get_point(self, *position): """Return the noise value of a specific position. Example usage: value = noise.getPoint(x, y, z) Args: position (Tuple[float, ...]): The point to sample at. Returns: float: The noise value at position. This will ...
python
def get_point(self, *position): """Return the noise value of a specific position. Example usage: value = noise.getPoint(x, y, z) Args: position (Tuple[float, ...]): The point to sample at. Returns: float: The noise value at position. This will ...
[ "def", "get_point", "(", "self", ",", "*", "position", ")", ":", "#array = self._array", "#for d, pos in enumerate(position):", "# array[d] = pos", "#array = self._cFloatArray(*position)", "array", "=", "_ffi", ".", "new", "(", "self", ".", "_arrayType", ",", "positi...
Return the noise value of a specific position. Example usage: value = noise.getPoint(x, y, z) Args: position (Tuple[float, ...]): The point to sample at. Returns: float: The noise value at position. This will be a floating point in the 0.0-1.0 range.
[ "Return", "the", "noise", "value", "of", "a", "specific", "position", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/noise.py#L144-L164
9,149
libtcod/python-tcod
tcod/map.py
compute_fov
def compute_fov( transparency: np.array, x: int, y: int, radius: int = 0, light_walls: bool = True, algorithm: int = tcod.constants.FOV_RESTRICTIVE, ) -> np.array: """Return the visible area of a field-of-view computation. `transparency` is a 2 dimensional array where all non-zero value...
python
def compute_fov( transparency: np.array, x: int, y: int, radius: int = 0, light_walls: bool = True, algorithm: int = tcod.constants.FOV_RESTRICTIVE, ) -> np.array: """Return the visible area of a field-of-view computation. `transparency` is a 2 dimensional array where all non-zero value...
[ "def", "compute_fov", "(", "transparency", ":", "np", ".", "array", ",", "x", ":", "int", ",", "y", ":", "int", ",", "radius", ":", "int", "=", "0", ",", "light_walls", ":", "bool", "=", "True", ",", "algorithm", ":", "int", "=", "tcod", ".", "co...
Return the visible area of a field-of-view computation. `transparency` is a 2 dimensional array where all non-zero values are considered transparent. The returned array will match the shape of this array. `x` and `y` are the 1st and 2nd coordinates of the origin point. Areas are visible when the...
[ "Return", "the", "visible", "area", "of", "a", "field", "-", "of", "-", "view", "computation", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/map.py#L147-L209
9,150
libtcod/python-tcod
tcod/map.py
Map.compute_fov
def compute_fov( self, x: int, y: int, radius: int = 0, light_walls: bool = True, algorithm: int = tcod.constants.FOV_RESTRICTIVE, ) -> None: """Compute a field-of-view on the current instance. Args: x (int): Point of view, x-coordinate. ...
python
def compute_fov( self, x: int, y: int, radius: int = 0, light_walls: bool = True, algorithm: int = tcod.constants.FOV_RESTRICTIVE, ) -> None: """Compute a field-of-view on the current instance. Args: x (int): Point of view, x-coordinate. ...
[ "def", "compute_fov", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "radius", ":", "int", "=", "0", ",", "light_walls", ":", "bool", "=", "True", ",", "algorithm", ":", "int", "=", "tcod", ".", "constants", ".", "FOV_RESTRICTIVE", "...
Compute a field-of-view on the current instance. Args: x (int): Point of view, x-coordinate. y (int): Point of view, y-coordinate. radius (int): Maximum view distance from the point of view. A value of `0` will give an infinite distance. light_wa...
[ "Compute", "a", "field", "-", "of", "-", "view", "on", "the", "current", "instance", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/map.py#L99-L123
9,151
libtcod/python-tcod
tcod/noise.py
Noise.sample_mgrid
def sample_mgrid(self, mgrid: np.array) -> np.array: """Sample a mesh-grid array and return the result. The :any:`sample_ogrid` method performs better as there is a lot of overhead when working with large mesh-grids. Args: mgrid (numpy.ndarray): A mesh-grid array of points ...
python
def sample_mgrid(self, mgrid: np.array) -> np.array: """Sample a mesh-grid array and return the result. The :any:`sample_ogrid` method performs better as there is a lot of overhead when working with large mesh-grids. Args: mgrid (numpy.ndarray): A mesh-grid array of points ...
[ "def", "sample_mgrid", "(", "self", ",", "mgrid", ":", "np", ".", "array", ")", "->", "np", ".", "array", ":", "mgrid", "=", "np", ".", "ascontiguousarray", "(", "mgrid", ",", "np", ".", "float32", ")", "if", "mgrid", ".", "shape", "[", "0", "]", ...
Sample a mesh-grid array and return the result. The :any:`sample_ogrid` method performs better as there is a lot of overhead when working with large mesh-grids. Args: mgrid (numpy.ndarray): A mesh-grid array of points to sample. A contiguous array of type `numpy.flo...
[ "Sample", "a", "mesh", "-", "grid", "array", "and", "return", "the", "result", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/noise.py#L162-L196
9,152
libtcod/python-tcod
tcod/noise.py
Noise.sample_ogrid
def sample_ogrid(self, ogrid: np.array) -> np.array: """Sample an open mesh-grid array and return the result. Args ogrid (Sequence[Sequence[float]]): An open mesh-grid. Returns: numpy.ndarray: An array of sampled points. The ``shape`` is based on the le...
python
def sample_ogrid(self, ogrid: np.array) -> np.array: """Sample an open mesh-grid array and return the result. Args ogrid (Sequence[Sequence[float]]): An open mesh-grid. Returns: numpy.ndarray: An array of sampled points. The ``shape`` is based on the le...
[ "def", "sample_ogrid", "(", "self", ",", "ogrid", ":", "np", ".", "array", ")", "->", "np", ".", "array", ":", "if", "len", "(", "ogrid", ")", "!=", "self", ".", "dimensions", ":", "raise", "ValueError", "(", "\"len(ogrid) must equal self.dimensions, \"", ...
Sample an open mesh-grid array and return the result. Args ogrid (Sequence[Sequence[float]]): An open mesh-grid. Returns: numpy.ndarray: An array of sampled points. The ``shape`` is based on the lengths of the open mesh-grid arrays. ...
[ "Sample", "an", "open", "mesh", "-", "grid", "array", "and", "return", "the", "result", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/noise.py#L198-L225
9,153
libtcod/python-tcod
tdl/event.py
_processEvents
def _processEvents(): """Flushes the event queue from libtcod into the global list _eventQueue""" global _mousel, _mousem, _mouser, _eventsflushed, _pushedEvents _eventsflushed = True events = _pushedEvents # get events from event.push _pushedEvents = [] # then clear the pushed events queue mou...
python
def _processEvents(): """Flushes the event queue from libtcod into the global list _eventQueue""" global _mousel, _mousem, _mouser, _eventsflushed, _pushedEvents _eventsflushed = True events = _pushedEvents # get events from event.push _pushedEvents = [] # then clear the pushed events queue mou...
[ "def", "_processEvents", "(", ")", ":", "global", "_mousel", ",", "_mousem", ",", "_mouser", ",", "_eventsflushed", ",", "_pushedEvents", "_eventsflushed", "=", "True", "events", "=", "_pushedEvents", "# get events from event.push", "_pushedEvents", "=", "[", "]", ...
Flushes the event queue from libtcod into the global list _eventQueue
[ "Flushes", "the", "event", "queue", "from", "libtcod", "into", "the", "global", "list", "_eventQueue" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/event.py#L331-L403
9,154
libtcod/python-tcod
tdl/event.py
wait
def wait(timeout=None, flush=True): """Wait for an event. Args: timeout (Optional[int]): The time in seconds that this function will wait before giving up and returning None. With the default value of None, this will block forever. flush (bool): If True a call to :any:`...
python
def wait(timeout=None, flush=True): """Wait for an event. Args: timeout (Optional[int]): The time in seconds that this function will wait before giving up and returning None. With the default value of None, this will block forever. flush (bool): If True a call to :any:`...
[ "def", "wait", "(", "timeout", "=", "None", ",", "flush", "=", "True", ")", ":", "if", "timeout", "is", "not", "None", ":", "timeout", "=", "timeout", "+", "_time", ".", "clock", "(", ")", "# timeout at this time", "while", "True", ":", "if", "_eventQu...
Wait for an event. Args: timeout (Optional[int]): The time in seconds that this function will wait before giving up and returning None. With the default value of None, this will block forever. flush (bool): If True a call to :any:`tdl.flush` will be made before ...
[ "Wait", "for", "an", "event", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/event.py#L428-L454
9,155
libtcod/python-tcod
tdl/event.py
App.run_once
def run_once(self): """Pump events to this App instance and then return. This works in the way described in :any:`App.run` except it immediately returns after the first :any:`update` call. Having multiple :any:`App` instances and selectively calling runOnce on them is a decent ...
python
def run_once(self): """Pump events to this App instance and then return. This works in the way described in :any:`App.run` except it immediately returns after the first :any:`update` call. Having multiple :any:`App` instances and selectively calling runOnce on them is a decent ...
[ "def", "run_once", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_App__prevTime'", ")", ":", "self", ".", "__prevTime", "=", "_time", ".", "clock", "(", ")", "# initiate __prevTime", "for", "event", "in", "get", "(", ")", ":", "if"...
Pump events to this App instance and then return. This works in the way described in :any:`App.run` except it immediately returns after the first :any:`update` call. Having multiple :any:`App` instances and selectively calling runOnce on them is a decent way to create a state machine.
[ "Pump", "events", "to", "this", "App", "instance", "and", "then", "return", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/event.py#L305-L328
9,156
libtcod/python-tcod
tcod/tileset.py
load_truetype_font
def load_truetype_font( path: str, tile_width: int, tile_height: int ) -> Tileset: """Return a new Tileset from a `.ttf` or `.otf` file. Same as :any:`set_truetype_font`, but returns a :any:`Tileset` instead. You can send this Tileset to :any:`set_default`. This function is provisional. The API m...
python
def load_truetype_font( path: str, tile_width: int, tile_height: int ) -> Tileset: """Return a new Tileset from a `.ttf` or `.otf` file. Same as :any:`set_truetype_font`, but returns a :any:`Tileset` instead. You can send this Tileset to :any:`set_default`. This function is provisional. The API m...
[ "def", "load_truetype_font", "(", "path", ":", "str", ",", "tile_width", ":", "int", ",", "tile_height", ":", "int", ")", "->", "Tileset", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "raise", "RuntimeError", "(", "\"File ...
Return a new Tileset from a `.ttf` or `.otf` file. Same as :any:`set_truetype_font`, but returns a :any:`Tileset` instead. You can send this Tileset to :any:`set_default`. This function is provisional. The API may change.
[ "Return", "a", "new", "Tileset", "from", "a", ".", "ttf", "or", ".", "otf", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tileset.py#L120-L134
9,157
libtcod/python-tcod
tcod/tileset.py
set_truetype_font
def set_truetype_font(path: str, tile_width: int, tile_height: int) -> None: """Set the default tileset from a `.ttf` or `.otf` file. `path` is the file path for the font file. `tile_width` and `tile_height` are the desired size of the tiles in the new tileset. The font will be scaled to fit the give...
python
def set_truetype_font(path: str, tile_width: int, tile_height: int) -> None: """Set the default tileset from a `.ttf` or `.otf` file. `path` is the file path for the font file. `tile_width` and `tile_height` are the desired size of the tiles in the new tileset. The font will be scaled to fit the give...
[ "def", "set_truetype_font", "(", "path", ":", "str", ",", "tile_width", ":", "int", ",", "tile_height", ":", "int", ")", "->", "None", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "raise", "RuntimeError", "(", "\"File not ...
Set the default tileset from a `.ttf` or `.otf` file. `path` is the file path for the font file. `tile_width` and `tile_height` are the desired size of the tiles in the new tileset. The font will be scaled to fit the given `tile_height` and `tile_width`. This function will only affect the `SDL2`...
[ "Set", "the", "default", "tileset", "from", "a", ".", "ttf", "or", ".", "otf", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tileset.py#L137-L157
9,158
libtcod/python-tcod
tcod/tileset.py
Tileset.get_tile
def get_tile(self, codepoint: int) -> np.array: """Return a copy of a tile for the given codepoint. If the tile does not exist yet then a blank array will be returned. The tile will have a shape of (height, width, rgba) and a dtype of uint8. Note that most grey-scale tiles will only u...
python
def get_tile(self, codepoint: int) -> np.array: """Return a copy of a tile for the given codepoint. If the tile does not exist yet then a blank array will be returned. The tile will have a shape of (height, width, rgba) and a dtype of uint8. Note that most grey-scale tiles will only u...
[ "def", "get_tile", "(", "self", ",", "codepoint", ":", "int", ")", "->", "np", ".", "array", ":", "tile", "=", "np", ".", "zeros", "(", "self", ".", "tile_shape", "+", "(", "4", ",", ")", ",", "dtype", "=", "np", ".", "uint8", ")", "lib", ".", ...
Return a copy of a tile for the given codepoint. If the tile does not exist yet then a blank array will be returned. The tile will have a shape of (height, width, rgba) and a dtype of uint8. Note that most grey-scale tiles will only use the alpha channel and will usually have a solid ...
[ "Return", "a", "copy", "of", "a", "tile", "for", "the", "given", "codepoint", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tileset.py#L55-L70
9,159
libtcod/python-tcod
tcod/tileset.py
Tileset.set_tile
def set_tile(self, codepoint: int, tile: np.array) -> None: """Upload a tile into this array. The tile can be in 32-bit color (height, width, rgba), or grey-scale (height, width). The tile should have a dtype of ``np.uint8``. This data may need to be sent to graphics card memory, this...
python
def set_tile(self, codepoint: int, tile: np.array) -> None: """Upload a tile into this array. The tile can be in 32-bit color (height, width, rgba), or grey-scale (height, width). The tile should have a dtype of ``np.uint8``. This data may need to be sent to graphics card memory, this...
[ "def", "set_tile", "(", "self", ",", "codepoint", ":", "int", ",", "tile", ":", "np", ".", "array", ")", "->", "None", ":", "tile", "=", "np", ".", "ascontiguousarray", "(", "tile", ",", "dtype", "=", "np", ".", "uint8", ")", "if", "tile", ".", "...
Upload a tile into this array. The tile can be in 32-bit color (height, width, rgba), or grey-scale (height, width). The tile should have a dtype of ``np.uint8``. This data may need to be sent to graphics card memory, this is a slow operation.
[ "Upload", "a", "tile", "into", "this", "array", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tileset.py#L72-L97
9,160
libtcod/python-tcod
build_libtcod.py
fix_header
def fix_header(filepath): """Removes leading whitespace from a MacOS header file. This whitespace is causing issues with directives on some platforms. """ with open(filepath, "r+") as f: current = f.read() fixed = "\n".join(line.strip() for line in current.split("\n")) if curren...
python
def fix_header(filepath): """Removes leading whitespace from a MacOS header file. This whitespace is causing issues with directives on some platforms. """ with open(filepath, "r+") as f: current = f.read() fixed = "\n".join(line.strip() for line in current.split("\n")) if curren...
[ "def", "fix_header", "(", "filepath", ")", ":", "with", "open", "(", "filepath", ",", "\"r+\"", ")", "as", "f", ":", "current", "=", "f", ".", "read", "(", ")", "fixed", "=", "\"\\n\"", ".", "join", "(", "line", ".", "strip", "(", ")", "for", "li...
Removes leading whitespace from a MacOS header file. This whitespace is causing issues with directives on some platforms.
[ "Removes", "leading", "whitespace", "from", "a", "MacOS", "header", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/build_libtcod.py#L145-L157
9,161
libtcod/python-tcod
build_libtcod.py
find_sdl_attrs
def find_sdl_attrs(prefix: str) -> Iterator[Tuple[str, Any]]: """Return names and values from `tcod.lib`. `prefix` is used to filter out which names to copy. """ from tcod._libtcod import lib if prefix.startswith("SDL_"): name_starts_at = 4 elif prefix.startswith("SDL"): name_s...
python
def find_sdl_attrs(prefix: str) -> Iterator[Tuple[str, Any]]: """Return names and values from `tcod.lib`. `prefix` is used to filter out which names to copy. """ from tcod._libtcod import lib if prefix.startswith("SDL_"): name_starts_at = 4 elif prefix.startswith("SDL"): name_s...
[ "def", "find_sdl_attrs", "(", "prefix", ":", "str", ")", "->", "Iterator", "[", "Tuple", "[", "str", ",", "Any", "]", "]", ":", "from", "tcod", ".", "_libtcod", "import", "lib", "if", "prefix", ".", "startswith", "(", "\"SDL_\"", ")", ":", "name_starts...
Return names and values from `tcod.lib`. `prefix` is used to filter out which names to copy.
[ "Return", "names", "and", "values", "from", "tcod", ".", "lib", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/build_libtcod.py#L357-L372
9,162
libtcod/python-tcod
build_libtcod.py
write_library_constants
def write_library_constants(): """Write libtcod constants into the tcod.constants module.""" from tcod._libtcod import lib, ffi import tcod.color with open("tcod/constants.py", "w") as f: all_names = [] f.write(CONSTANT_MODULE_HEADER) for name in dir(lib): value = ge...
python
def write_library_constants(): """Write libtcod constants into the tcod.constants module.""" from tcod._libtcod import lib, ffi import tcod.color with open("tcod/constants.py", "w") as f: all_names = [] f.write(CONSTANT_MODULE_HEADER) for name in dir(lib): value = ge...
[ "def", "write_library_constants", "(", ")", ":", "from", "tcod", ".", "_libtcod", "import", "lib", ",", "ffi", "import", "tcod", ".", "color", "with", "open", "(", "\"tcod/constants.py\"", ",", "\"w\"", ")", "as", "f", ":", "all_names", "=", "[", "]", "f...
Write libtcod constants into the tcod.constants module.
[ "Write", "libtcod", "constants", "into", "the", "tcod", ".", "constants", "module", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/build_libtcod.py#L394-L458
9,163
libtcod/python-tcod
build_libtcod.py
CustomPostParser.visit_EnumeratorList
def visit_EnumeratorList(self, node): """Replace enumerator expressions with '...' stubs.""" for type, enum in node.children(): if enum.value is None: pass elif isinstance(enum.value, (c_ast.BinaryOp, c_ast.UnaryOp)): enum.value = c_ast.Constant("i...
python
def visit_EnumeratorList(self, node): """Replace enumerator expressions with '...' stubs.""" for type, enum in node.children(): if enum.value is None: pass elif isinstance(enum.value, (c_ast.BinaryOp, c_ast.UnaryOp)): enum.value = c_ast.Constant("i...
[ "def", "visit_EnumeratorList", "(", "self", ",", "node", ")", ":", "for", "type", ",", "enum", "in", "node", ".", "children", "(", ")", ":", "if", "enum", ".", "value", "is", "None", ":", "pass", "elif", "isinstance", "(", "enum", ".", "value", ",", ...
Replace enumerator expressions with '...' stubs.
[ "Replace", "enumerator", "expressions", "with", "...", "stubs", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/build_libtcod.py#L214-L222
9,164
libtcod/python-tcod
tcod/libtcodpy.py
bsp_new_with_size
def bsp_new_with_size(x: int, y: int, w: int, h: int) -> tcod.bsp.BSP: """Create a new BSP instance with the given rectangle. Args: x (int): Rectangle left coordinate. y (int): Rectangle top coordinate. w (int): Rectangle width. h (int): Rectangle height. Returns: B...
python
def bsp_new_with_size(x: int, y: int, w: int, h: int) -> tcod.bsp.BSP: """Create a new BSP instance with the given rectangle. Args: x (int): Rectangle left coordinate. y (int): Rectangle top coordinate. w (int): Rectangle width. h (int): Rectangle height. Returns: B...
[ "def", "bsp_new_with_size", "(", "x", ":", "int", ",", "y", ":", "int", ",", "w", ":", "int", ",", "h", ":", "int", ")", "->", "tcod", ".", "bsp", ".", "BSP", ":", "return", "Bsp", "(", "x", ",", "y", ",", "w", ",", "h", ")" ]
Create a new BSP instance with the given rectangle. Args: x (int): Rectangle left coordinate. y (int): Rectangle top coordinate. w (int): Rectangle width. h (int): Rectangle height. Returns: BSP: A new BSP instance. .. deprecated:: 2.0 Call the :any:`BSP` cl...
[ "Create", "a", "new", "BSP", "instance", "with", "the", "given", "rectangle", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L533-L548
9,165
libtcod/python-tcod
tcod/libtcodpy.py
_bsp_traverse
def _bsp_traverse( node_iter: Iterable[tcod.bsp.BSP], callback: Callable[[tcod.bsp.BSP, Any], None], userData: Any, ) -> None: """pack callback into a handle for use with the callback _pycall_bsp_callback """ for node in node_iter: callback(node, userData)
python
def _bsp_traverse( node_iter: Iterable[tcod.bsp.BSP], callback: Callable[[tcod.bsp.BSP, Any], None], userData: Any, ) -> None: """pack callback into a handle for use with the callback _pycall_bsp_callback """ for node in node_iter: callback(node, userData)
[ "def", "_bsp_traverse", "(", "node_iter", ":", "Iterable", "[", "tcod", ".", "bsp", ".", "BSP", "]", ",", "callback", ":", "Callable", "[", "[", "tcod", ".", "bsp", ".", "BSP", ",", "Any", "]", ",", "None", "]", ",", "userData", ":", "Any", ",", ...
pack callback into a handle for use with the callback _pycall_bsp_callback
[ "pack", "callback", "into", "a", "handle", "for", "use", "with", "the", "callback", "_pycall_bsp_callback" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L649-L658
9,166
libtcod/python-tcod
tcod/libtcodpy.py
color_lerp
def color_lerp( c1: Tuple[int, int, int], c2: Tuple[int, int, int], a: float ) -> Color: """Return the linear interpolation between two colors. ``a`` is the interpolation value, with 0 returing ``c1``, 1 returning ``c2``, and 0.5 returing a color halfway between both. Args: c1 (Union[Tuple...
python
def color_lerp( c1: Tuple[int, int, int], c2: Tuple[int, int, int], a: float ) -> Color: """Return the linear interpolation between two colors. ``a`` is the interpolation value, with 0 returing ``c1``, 1 returning ``c2``, and 0.5 returing a color halfway between both. Args: c1 (Union[Tuple...
[ "def", "color_lerp", "(", "c1", ":", "Tuple", "[", "int", ",", "int", ",", "int", "]", ",", "c2", ":", "Tuple", "[", "int", ",", "int", ",", "int", "]", ",", "a", ":", "float", ")", "->", "Color", ":", "return", "Color", ".", "_new_from_cdata", ...
Return the linear interpolation between two colors. ``a`` is the interpolation value, with 0 returing ``c1``, 1 returning ``c2``, and 0.5 returing a color halfway between both. Args: c1 (Union[Tuple[int, int, int], Sequence[int]]): The first color. At a=0. c2 (Union[Tuple[int,...
[ "Return", "the", "linear", "interpolation", "between", "two", "colors", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L762-L780
9,167
libtcod/python-tcod
tcod/libtcodpy.py
color_scale_HSV
def color_scale_HSV(c: Color, scoef: float, vcoef: float) -> None: """Scale a color's saturation and value. Does not return a new Color. ``c`` is modified inplace. Args: c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list. scoef (float): Saturation multiplier, from 0 to 1....
python
def color_scale_HSV(c: Color, scoef: float, vcoef: float) -> None: """Scale a color's saturation and value. Does not return a new Color. ``c`` is modified inplace. Args: c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list. scoef (float): Saturation multiplier, from 0 to 1....
[ "def", "color_scale_HSV", "(", "c", ":", "Color", ",", "scoef", ":", "float", ",", "vcoef", ":", "float", ")", "->", "None", ":", "color_p", "=", "ffi", ".", "new", "(", "\"TCOD_color_t*\"", ")", "color_p", ".", "r", ",", "color_p", ".", "g", ",", ...
Scale a color's saturation and value. Does not return a new Color. ``c`` is modified inplace. Args: c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list. scoef (float): Saturation multiplier, from 0 to 1. Use 1 to keep current saturation. vcoef (f...
[ "Scale", "a", "color", "s", "saturation", "and", "value", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L818-L833
9,168
libtcod/python-tcod
tcod/libtcodpy.py
color_gen_map
def color_gen_map( colors: Iterable[Tuple[int, int, int]], indexes: Iterable[int] ) -> List[Color]: """Return a smoothly defined scale of colors. If ``indexes`` is [0, 3, 9] for example, the first color from ``colors`` will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9. All in-be...
python
def color_gen_map( colors: Iterable[Tuple[int, int, int]], indexes: Iterable[int] ) -> List[Color]: """Return a smoothly defined scale of colors. If ``indexes`` is [0, 3, 9] for example, the first color from ``colors`` will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9. All in-be...
[ "def", "color_gen_map", "(", "colors", ":", "Iterable", "[", "Tuple", "[", "int", ",", "int", ",", "int", "]", "]", ",", "indexes", ":", "Iterable", "[", "int", "]", ")", "->", "List", "[", "Color", "]", ":", "ccolors", "=", "ffi", ".", "new", "(...
Return a smoothly defined scale of colors. If ``indexes`` is [0, 3, 9] for example, the first color from ``colors`` will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9. All in-betweens will be filled with a gradient. Args: colors (Iterable[Union[Tuple[int, int, int], Sequence...
[ "Return", "a", "smoothly", "defined", "scale", "of", "colors", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L837-L863
9,169
libtcod/python-tcod
tcod/libtcodpy.py
console_init_root
def console_init_root( w: int, h: int, title: Optional[str] = None, fullscreen: bool = False, renderer: Optional[int] = None, order: str = "C", ) -> tcod.console.Console: """Set up the primary display and return the root console. `w` and `h` are the columns and rows of the new window (i...
python
def console_init_root( w: int, h: int, title: Optional[str] = None, fullscreen: bool = False, renderer: Optional[int] = None, order: str = "C", ) -> tcod.console.Console: """Set up the primary display and return the root console. `w` and `h` are the columns and rows of the new window (i...
[ "def", "console_init_root", "(", "w", ":", "int", ",", "h", ":", "int", ",", "title", ":", "Optional", "[", "str", "]", "=", "None", ",", "fullscreen", ":", "bool", "=", "False", ",", "renderer", ":", "Optional", "[", "int", "]", "=", "None", ",", ...
Set up the primary display and return the root console. `w` and `h` are the columns and rows of the new window (in tiles.) `title` is an optional string to display on the windows title bar. `fullscreen` determines if the window will start in fullscreen. Fullscreen mode is unreliable unless the rende...
[ "Set", "up", "the", "primary", "display", "and", "return", "the", "root", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L866-L935
9,170
libtcod/python-tcod
tcod/libtcodpy.py
console_set_custom_font
def console_set_custom_font( fontFile: AnyStr, flags: int = FONT_LAYOUT_ASCII_INCOL, nb_char_horiz: int = 0, nb_char_vertic: int = 0, ) -> None: """Load the custom font file at `fontFile`. Call this before function before calling :any:`tcod.console_init_root`. Flags can be a mix of the fol...
python
def console_set_custom_font( fontFile: AnyStr, flags: int = FONT_LAYOUT_ASCII_INCOL, nb_char_horiz: int = 0, nb_char_vertic: int = 0, ) -> None: """Load the custom font file at `fontFile`. Call this before function before calling :any:`tcod.console_init_root`. Flags can be a mix of the fol...
[ "def", "console_set_custom_font", "(", "fontFile", ":", "AnyStr", ",", "flags", ":", "int", "=", "FONT_LAYOUT_ASCII_INCOL", ",", "nb_char_horiz", ":", "int", "=", "0", ",", "nb_char_vertic", ":", "int", "=", "0", ",", ")", "->", "None", ":", "if", "not", ...
Load the custom font file at `fontFile`. Call this before function before calling :any:`tcod.console_init_root`. Flags can be a mix of the following: * tcod.FONT_LAYOUT_ASCII_INCOL: Decode tileset raw in column-major order. * tcod.FONT_LAYOUT_ASCII_INROW: Decode tileset raw in row-major o...
[ "Load", "the", "custom", "font", "file", "at", "fontFile", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L938-L971
9,171
libtcod/python-tcod
tcod/libtcodpy.py
console_get_width
def console_get_width(con: tcod.console.Console) -> int: """Return the width of a console. Args: con (Console): Any Console instance. Returns: int: The width of a Console. .. deprecated:: 2.0 Use `Console.width` instead. """ return int(lib.TCOD_console_get_width(_conso...
python
def console_get_width(con: tcod.console.Console) -> int: """Return the width of a console. Args: con (Console): Any Console instance. Returns: int: The width of a Console. .. deprecated:: 2.0 Use `Console.width` instead. """ return int(lib.TCOD_console_get_width(_conso...
[ "def", "console_get_width", "(", "con", ":", "tcod", ".", "console", ".", "Console", ")", "->", "int", ":", "return", "int", "(", "lib", ".", "TCOD_console_get_width", "(", "_console", "(", "con", ")", ")", ")" ]
Return the width of a console. Args: con (Console): Any Console instance. Returns: int: The width of a Console. .. deprecated:: 2.0 Use `Console.width` instead.
[ "Return", "the", "width", "of", "a", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L975-L987
9,172
libtcod/python-tcod
tcod/libtcodpy.py
console_get_height
def console_get_height(con: tcod.console.Console) -> int: """Return the height of a console. Args: con (Console): Any Console instance. Returns: int: The height of a Console. .. deprecated:: 2.0 Use `Console.height` instead. """ return int(lib.TCOD_console_get_height(_...
python
def console_get_height(con: tcod.console.Console) -> int: """Return the height of a console. Args: con (Console): Any Console instance. Returns: int: The height of a Console. .. deprecated:: 2.0 Use `Console.height` instead. """ return int(lib.TCOD_console_get_height(_...
[ "def", "console_get_height", "(", "con", ":", "tcod", ".", "console", ".", "Console", ")", "->", "int", ":", "return", "int", "(", "lib", ".", "TCOD_console_get_height", "(", "_console", "(", "con", ")", ")", ")" ]
Return the height of a console. Args: con (Console): Any Console instance. Returns: int: The height of a Console. .. deprecated:: 2.0 Use `Console.height` instead.
[ "Return", "the", "height", "of", "a", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L991-L1003
9,173
libtcod/python-tcod
tcod/libtcodpy.py
console_map_ascii_code_to_font
def console_map_ascii_code_to_font( asciiCode: int, fontCharX: int, fontCharY: int ) -> None: """Set a character code to new coordinates on the tile-set. `asciiCode` must be within the bounds created during the initialization of the loaded tile-set. For example, you can't use 255 here unless you have ...
python
def console_map_ascii_code_to_font( asciiCode: int, fontCharX: int, fontCharY: int ) -> None: """Set a character code to new coordinates on the tile-set. `asciiCode` must be within the bounds created during the initialization of the loaded tile-set. For example, you can't use 255 here unless you have ...
[ "def", "console_map_ascii_code_to_font", "(", "asciiCode", ":", "int", ",", "fontCharX", ":", "int", ",", "fontCharY", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_console_map_ascii_code_to_font", "(", "_int", "(", "asciiCode", ")", ",", "fontCharX", ...
Set a character code to new coordinates on the tile-set. `asciiCode` must be within the bounds created during the initialization of the loaded tile-set. For example, you can't use 255 here unless you have a 256 tile tile-set loaded. This applies to all functions in this group. Args: asciiCod...
[ "Set", "a", "character", "code", "to", "new", "coordinates", "on", "the", "tile", "-", "set", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1007-L1025
9,174
libtcod/python-tcod
tcod/libtcodpy.py
console_map_ascii_codes_to_font
def console_map_ascii_codes_to_font( firstAsciiCode: int, nbCodes: int, fontCharX: int, fontCharY: int ) -> None: """Remap a contiguous set of codes to a contiguous set of tiles. Both the tile-set and character codes must be contiguous to use this function. If this is not the case you may want to use ...
python
def console_map_ascii_codes_to_font( firstAsciiCode: int, nbCodes: int, fontCharX: int, fontCharY: int ) -> None: """Remap a contiguous set of codes to a contiguous set of tiles. Both the tile-set and character codes must be contiguous to use this function. If this is not the case you may want to use ...
[ "def", "console_map_ascii_codes_to_font", "(", "firstAsciiCode", ":", "int", ",", "nbCodes", ":", "int", ",", "fontCharX", ":", "int", ",", "fontCharY", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_console_map_ascii_codes_to_font", "(", "_int", "(", "...
Remap a contiguous set of codes to a contiguous set of tiles. Both the tile-set and character codes must be contiguous to use this function. If this is not the case you may want to use :any:`console_map_ascii_code_to_font`. Args: firstAsciiCode (int): The starting character code. nbCo...
[ "Remap", "a", "contiguous", "set", "of", "codes", "to", "a", "contiguous", "set", "of", "tiles", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1029-L1049
9,175
libtcod/python-tcod
tcod/libtcodpy.py
console_map_string_to_font
def console_map_string_to_font(s: str, fontCharX: int, fontCharY: int) -> None: """Remap a string of codes to a contiguous set of tiles. Args: s (AnyStr): A string of character codes to map to new values. The null character `'\\x00'` will prematurely end this fun...
python
def console_map_string_to_font(s: str, fontCharX: int, fontCharY: int) -> None: """Remap a string of codes to a contiguous set of tiles. Args: s (AnyStr): A string of character codes to map to new values. The null character `'\\x00'` will prematurely end this fun...
[ "def", "console_map_string_to_font", "(", "s", ":", "str", ",", "fontCharX", ":", "int", ",", "fontCharY", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_console_map_string_to_font_utf", "(", "_unicode", "(", "s", ")", ",", "fontCharX", ",", "fontChar...
Remap a string of codes to a contiguous set of tiles. Args: s (AnyStr): A string of character codes to map to new values. The null character `'\\x00'` will prematurely end this function. fontCharX (int): The starting X tile coordinate on the loaded tileset. ...
[ "Remap", "a", "string", "of", "codes", "to", "a", "contiguous", "set", "of", "tiles", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1053-L1065
9,176
libtcod/python-tcod
tcod/libtcodpy.py
console_set_default_background
def console_set_default_background( con: tcod.console.Console, col: Tuple[int, int, int] ) -> None: """Change the default background color for a console. Args: con (Console): Any Console instance. col (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color i...
python
def console_set_default_background( con: tcod.console.Console, col: Tuple[int, int, int] ) -> None: """Change the default background color for a console. Args: con (Console): Any Console instance. col (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color i...
[ "def", "console_set_default_background", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "col", ":", "Tuple", "[", "int", ",", "int", ",", "int", "]", ")", "->", "None", ":", "lib", ".", "TCOD_console_set_default_background", "(", "_console", ...
Change the default background color for a console. Args: con (Console): Any Console instance. col (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance. .. deprecated:: 8.5 Use :any:`Console.default_bg` instead.
[ "Change", "the", "default", "background", "color", "for", "a", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1138-L1151
9,177
libtcod/python-tcod
tcod/libtcodpy.py
console_set_default_foreground
def console_set_default_foreground( con: tcod.console.Console, col: Tuple[int, int, int] ) -> None: """Change the default foreground color for a console. Args: con (Console): Any Console instance. col (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color i...
python
def console_set_default_foreground( con: tcod.console.Console, col: Tuple[int, int, int] ) -> None: """Change the default foreground color for a console. Args: con (Console): Any Console instance. col (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color i...
[ "def", "console_set_default_foreground", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "col", ":", "Tuple", "[", "int", ",", "int", ",", "int", "]", ")", "->", "None", ":", "lib", ".", "TCOD_console_set_default_foreground", "(", "_console", ...
Change the default foreground color for a console. Args: con (Console): Any Console instance. col (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance. .. deprecated:: 8.5 Use :any:`Console.default_fg` instead.
[ "Change", "the", "default", "foreground", "color", "for", "a", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1155-L1168
9,178
libtcod/python-tcod
tcod/libtcodpy.py
console_put_char_ex
def console_put_char_ex( con: tcod.console.Console, x: int, y: int, c: Union[int, str], fore: Tuple[int, int, int], back: Tuple[int, int, int], ) -> None: """Draw the character c at x,y using the colors fore and back. Args: con (Console): Any Console instance. x (int): C...
python
def console_put_char_ex( con: tcod.console.Console, x: int, y: int, c: Union[int, str], fore: Tuple[int, int, int], back: Tuple[int, int, int], ) -> None: """Draw the character c at x,y using the colors fore and back. Args: con (Console): Any Console instance. x (int): C...
[ "def", "console_put_char_ex", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "c", ":", "Union", "[", "int", ",", "str", "]", ",", "fore", ":", "Tuple", "[", "int", ",", "int", ",", "int...
Draw the character c at x,y using the colors fore and back. Args: con (Console): Any Console instance. x (int): Character x position from the left. y (int): Character y position from the top. c (Union[int, AnyStr]): Character to draw, can be an integer or string. fore (Union...
[ "Draw", "the", "character", "c", "at", "x", "y", "using", "the", "colors", "fore", "and", "back", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1209-L1229
9,179
libtcod/python-tcod
tcod/libtcodpy.py
console_set_char_background
def console_set_char_background( con: tcod.console.Console, x: int, y: int, col: Tuple[int, int, int], flag: int = BKGND_SET, ) -> None: """Change the background color of x,y to col using a blend mode. Args: con (Console): Any Console instance. x (int): Character x position ...
python
def console_set_char_background( con: tcod.console.Console, x: int, y: int, col: Tuple[int, int, int], flag: int = BKGND_SET, ) -> None: """Change the background color of x,y to col using a blend mode. Args: con (Console): Any Console instance. x (int): Character x position ...
[ "def", "console_set_char_background", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "col", ":", "Tuple", "[", "int", ",", "int", ",", "int", "]", ",", "flag", ":", "int", "=", "BKGND_SET",...
Change the background color of x,y to col using a blend mode. Args: con (Console): Any Console instance. x (int): Character x position from the left. y (int): Character y position from the top. col (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Co...
[ "Change", "the", "background", "color", "of", "x", "y", "to", "col", "using", "a", "blend", "mode", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1233-L1250
9,180
libtcod/python-tcod
tcod/libtcodpy.py
console_set_char_foreground
def console_set_char_foreground( con: tcod.console.Console, x: int, y: int, col: Tuple[int, int, int] ) -> None: """Change the foreground color of x,y to col. Args: con (Console): Any Console instance. x (int): Character x position from the left. y (int): Character y position from t...
python
def console_set_char_foreground( con: tcod.console.Console, x: int, y: int, col: Tuple[int, int, int] ) -> None: """Change the foreground color of x,y to col. Args: con (Console): Any Console instance. x (int): Character x position from the left. y (int): Character y position from t...
[ "def", "console_set_char_foreground", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "col", ":", "Tuple", "[", "int", ",", "int", ",", "int", "]", ")", "->", "None", ":", "lib", ".", "TCO...
Change the foreground color of x,y to col. Args: con (Console): Any Console instance. x (int): Character x position from the left. y (int): Character y position from the top. col (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance. ...
[ "Change", "the", "foreground", "color", "of", "x", "y", "to", "col", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1254-L1270
9,181
libtcod/python-tcod
tcod/libtcodpy.py
console_set_char
def console_set_char( con: tcod.console.Console, x: int, y: int, c: Union[int, str] ) -> None: """Change the character at x,y to c, keeping the current colors. Args: con (Console): Any Console instance. x (int): Character x position from the left. y (int): Character y position from ...
python
def console_set_char( con: tcod.console.Console, x: int, y: int, c: Union[int, str] ) -> None: """Change the character at x,y to c, keeping the current colors. Args: con (Console): Any Console instance. x (int): Character x position from the left. y (int): Character y position from ...
[ "def", "console_set_char", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "c", ":", "Union", "[", "int", ",", "str", "]", ")", "->", "None", ":", "lib", ".", "TCOD_console_set_char", "(", ...
Change the character at x,y to c, keeping the current colors. Args: con (Console): Any Console instance. x (int): Character x position from the left. y (int): Character y position from the top. c (Union[int, AnyStr]): Character to draw, can be an integer or string. .. deprecate...
[ "Change", "the", "character", "at", "x", "y", "to", "c", "keeping", "the", "current", "colors", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1274-L1289
9,182
libtcod/python-tcod
tcod/libtcodpy.py
console_set_background_flag
def console_set_background_flag(con: tcod.console.Console, flag: int) -> None: """Change the default blend mode for this console. Args: con (Console): Any Console instance. flag (int): Blend mode to use by default. .. deprecated:: 8.5 Set :any:`Console.default_bg_blend` instead. ...
python
def console_set_background_flag(con: tcod.console.Console, flag: int) -> None: """Change the default blend mode for this console. Args: con (Console): Any Console instance. flag (int): Blend mode to use by default. .. deprecated:: 8.5 Set :any:`Console.default_bg_blend` instead. ...
[ "def", "console_set_background_flag", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "flag", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_console_set_background_flag", "(", "_console", "(", "con", ")", ",", "flag", ")" ]
Change the default blend mode for this console. Args: con (Console): Any Console instance. flag (int): Blend mode to use by default. .. deprecated:: 8.5 Set :any:`Console.default_bg_blend` instead.
[ "Change", "the", "default", "blend", "mode", "for", "this", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1293-L1303
9,183
libtcod/python-tcod
tcod/libtcodpy.py
console_get_background_flag
def console_get_background_flag(con: tcod.console.Console) -> int: """Return this consoles current blend mode. Args: con (Console): Any Console instance. .. deprecated:: 8.5 Check :any:`Console.default_bg_blend` instead. """ return int(lib.TCOD_console_get_background_flag(_console(...
python
def console_get_background_flag(con: tcod.console.Console) -> int: """Return this consoles current blend mode. Args: con (Console): Any Console instance. .. deprecated:: 8.5 Check :any:`Console.default_bg_blend` instead. """ return int(lib.TCOD_console_get_background_flag(_console(...
[ "def", "console_get_background_flag", "(", "con", ":", "tcod", ".", "console", ".", "Console", ")", "->", "int", ":", "return", "int", "(", "lib", ".", "TCOD_console_get_background_flag", "(", "_console", "(", "con", ")", ")", ")" ]
Return this consoles current blend mode. Args: con (Console): Any Console instance. .. deprecated:: 8.5 Check :any:`Console.default_bg_blend` instead.
[ "Return", "this", "consoles", "current", "blend", "mode", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1307-L1316
9,184
libtcod/python-tcod
tcod/libtcodpy.py
console_set_alignment
def console_set_alignment(con: tcod.console.Console, alignment: int) -> None: """Change this consoles current alignment mode. * tcod.LEFT * tcod.CENTER * tcod.RIGHT Args: con (Console): Any Console instance. alignment (int): .. deprecated:: 8.5 Set :any:`Console.defaul...
python
def console_set_alignment(con: tcod.console.Console, alignment: int) -> None: """Change this consoles current alignment mode. * tcod.LEFT * tcod.CENTER * tcod.RIGHT Args: con (Console): Any Console instance. alignment (int): .. deprecated:: 8.5 Set :any:`Console.defaul...
[ "def", "console_set_alignment", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "alignment", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_console_set_alignment", "(", "_console", "(", "con", ")", ",", "alignment", ")" ]
Change this consoles current alignment mode. * tcod.LEFT * tcod.CENTER * tcod.RIGHT Args: con (Console): Any Console instance. alignment (int): .. deprecated:: 8.5 Set :any:`Console.default_alignment` instead.
[ "Change", "this", "consoles", "current", "alignment", "mode", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1320-L1334
9,185
libtcod/python-tcod
tcod/libtcodpy.py
console_get_alignment
def console_get_alignment(con: tcod.console.Console) -> int: """Return this consoles current alignment mode. Args: con (Console): Any Console instance. .. deprecated:: 8.5 Check :any:`Console.default_alignment` instead. """ return int(lib.TCOD_console_get_alignment(_console(con)))
python
def console_get_alignment(con: tcod.console.Console) -> int: """Return this consoles current alignment mode. Args: con (Console): Any Console instance. .. deprecated:: 8.5 Check :any:`Console.default_alignment` instead. """ return int(lib.TCOD_console_get_alignment(_console(con)))
[ "def", "console_get_alignment", "(", "con", ":", "tcod", ".", "console", ".", "Console", ")", "->", "int", ":", "return", "int", "(", "lib", ".", "TCOD_console_get_alignment", "(", "_console", "(", "con", ")", ")", ")" ]
Return this consoles current alignment mode. Args: con (Console): Any Console instance. .. deprecated:: 8.5 Check :any:`Console.default_alignment` instead.
[ "Return", "this", "consoles", "current", "alignment", "mode", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1338-L1347
9,186
libtcod/python-tcod
tcod/libtcodpy.py
console_print_ex
def console_print_ex( con: tcod.console.Console, x: int, y: int, flag: int, alignment: int, fmt: str, ) -> None: """Print a string on a console using a blend mode and alignment mode. Args: con (Console): Any Console instance. x (int): Character x position from the left. ...
python
def console_print_ex( con: tcod.console.Console, x: int, y: int, flag: int, alignment: int, fmt: str, ) -> None: """Print a string on a console using a blend mode and alignment mode. Args: con (Console): Any Console instance. x (int): Character x position from the left. ...
[ "def", "console_print_ex", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "flag", ":", "int", ",", "alignment", ":", "int", ",", "fmt", ":", "str", ",", ")", "->", "None", ":", "lib", "...
Print a string on a console using a blend mode and alignment mode. Args: con (Console): Any Console instance. x (int): Character x position from the left. y (int): Character y position from the top. .. deprecated:: 8.5 Use :any:`Console.print_` instead.
[ "Print", "a", "string", "on", "a", "console", "using", "a", "blend", "mode", "and", "alignment", "mode", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1367-L1385
9,187
libtcod/python-tcod
tcod/libtcodpy.py
console_print_rect_ex
def console_print_rect_ex( con: tcod.console.Console, x: int, y: int, w: int, h: int, flag: int, alignment: int, fmt: str, ) -> int: """Print a string constrained to a rectangle with blend and alignment. Returns: int: The number of lines of text once word-wrapped. ....
python
def console_print_rect_ex( con: tcod.console.Console, x: int, y: int, w: int, h: int, flag: int, alignment: int, fmt: str, ) -> int: """Print a string constrained to a rectangle with blend and alignment. Returns: int: The number of lines of text once word-wrapped. ....
[ "def", "console_print_rect_ex", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "w", ":", "int", ",", "h", ":", "int", ",", "flag", ":", "int", ",", "alignment", ":", "int", ",", "fmt", ...
Print a string constrained to a rectangle with blend and alignment. Returns: int: The number of lines of text once word-wrapped. .. deprecated:: 8.5 Use :any:`Console.print_rect` instead.
[ "Print", "a", "string", "constrained", "to", "a", "rectangle", "with", "blend", "and", "alignment", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1412-L1434
9,188
libtcod/python-tcod
tcod/libtcodpy.py
console_get_height_rect
def console_get_height_rect( con: tcod.console.Console, x: int, y: int, w: int, h: int, fmt: str ) -> int: """Return the height of this text once word-wrapped into this rectangle. Returns: int: The number of lines of text once word-wrapped. .. deprecated:: 8.5 Use :any:`Console.get_hei...
python
def console_get_height_rect( con: tcod.console.Console, x: int, y: int, w: int, h: int, fmt: str ) -> int: """Return the height of this text once word-wrapped into this rectangle. Returns: int: The number of lines of text once word-wrapped. .. deprecated:: 8.5 Use :any:`Console.get_hei...
[ "def", "console_get_height_rect", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "w", ":", "int", ",", "h", ":", "int", ",", "fmt", ":", "str", ")", "->", "int", ":", "return", "int", "...
Return the height of this text once word-wrapped into this rectangle. Returns: int: The number of lines of text once word-wrapped. .. deprecated:: 8.5 Use :any:`Console.get_height_rect` instead.
[ "Return", "the", "height", "of", "this", "text", "once", "word", "-", "wrapped", "into", "this", "rectangle", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1438-L1453
9,189
libtcod/python-tcod
tcod/libtcodpy.py
console_print_frame
def console_print_frame( con: tcod.console.Console, x: int, y: int, w: int, h: int, clear: bool = True, flag: int = BKGND_DEFAULT, fmt: str = "", ) -> None: """Draw a framed rectangle with optinal text. This uses the default background color and blend mode to fill the rectan...
python
def console_print_frame( con: tcod.console.Console, x: int, y: int, w: int, h: int, clear: bool = True, flag: int = BKGND_DEFAULT, fmt: str = "", ) -> None: """Draw a framed rectangle with optinal text. This uses the default background color and blend mode to fill the rectan...
[ "def", "console_print_frame", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "w", ":", "int", ",", "h", ":", "int", ",", "clear", ":", "bool", "=", "True", ",", "flag", ":", "int", "=",...
Draw a framed rectangle with optinal text. This uses the default background color and blend mode to fill the rectangle and the default foreground to draw the outline. `fmt` will be printed on the inside of the rectangle, word-wrapped. If `fmt` is empty then no title will be drawn. .. versionchang...
[ "Draw", "a", "framed", "rectangle", "with", "optinal", "text", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1513-L1538
9,190
libtcod/python-tcod
tcod/libtcodpy.py
console_get_default_background
def console_get_default_background(con: tcod.console.Console) -> Color: """Return this consoles default background color. .. deprecated:: 8.5 Use :any:`Console.default_bg` instead. """ return Color._new_from_cdata( lib.TCOD_console_get_default_background(_console(con)) )
python
def console_get_default_background(con: tcod.console.Console) -> Color: """Return this consoles default background color. .. deprecated:: 8.5 Use :any:`Console.default_bg` instead. """ return Color._new_from_cdata( lib.TCOD_console_get_default_background(_console(con)) )
[ "def", "console_get_default_background", "(", "con", ":", "tcod", ".", "console", ".", "Console", ")", "->", "Color", ":", "return", "Color", ".", "_new_from_cdata", "(", "lib", ".", "TCOD_console_get_default_background", "(", "_console", "(", "con", ")", ")", ...
Return this consoles default background color. .. deprecated:: 8.5 Use :any:`Console.default_bg` instead.
[ "Return", "this", "consoles", "default", "background", "color", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1558-L1566
9,191
libtcod/python-tcod
tcod/libtcodpy.py
console_get_default_foreground
def console_get_default_foreground(con: tcod.console.Console) -> Color: """Return this consoles default foreground color. .. deprecated:: 8.5 Use :any:`Console.default_fg` instead. """ return Color._new_from_cdata( lib.TCOD_console_get_default_foreground(_console(con)) )
python
def console_get_default_foreground(con: tcod.console.Console) -> Color: """Return this consoles default foreground color. .. deprecated:: 8.5 Use :any:`Console.default_fg` instead. """ return Color._new_from_cdata( lib.TCOD_console_get_default_foreground(_console(con)) )
[ "def", "console_get_default_foreground", "(", "con", ":", "tcod", ".", "console", ".", "Console", ")", "->", "Color", ":", "return", "Color", ".", "_new_from_cdata", "(", "lib", ".", "TCOD_console_get_default_foreground", "(", "_console", "(", "con", ")", ")", ...
Return this consoles default foreground color. .. deprecated:: 8.5 Use :any:`Console.default_fg` instead.
[ "Return", "this", "consoles", "default", "foreground", "color", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1570-L1578
9,192
libtcod/python-tcod
tcod/libtcodpy.py
console_get_char_background
def console_get_char_background( con: tcod.console.Console, x: int, y: int ) -> Color: """Return the background color at the x,y of this console. .. deprecated:: 8.4 Array access performs significantly faster than using this function. See :any:`Console.bg`. """ return Color._new_fro...
python
def console_get_char_background( con: tcod.console.Console, x: int, y: int ) -> Color: """Return the background color at the x,y of this console. .. deprecated:: 8.4 Array access performs significantly faster than using this function. See :any:`Console.bg`. """ return Color._new_fro...
[ "def", "console_get_char_background", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "Color", ":", "return", "Color", ".", "_new_from_cdata", "(", "lib", ".", "TCOD_console_get_char_background"...
Return the background color at the x,y of this console. .. deprecated:: 8.4 Array access performs significantly faster than using this function. See :any:`Console.bg`.
[ "Return", "the", "background", "color", "at", "the", "x", "y", "of", "this", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1582-L1593
9,193
libtcod/python-tcod
tcod/libtcodpy.py
console_get_char_foreground
def console_get_char_foreground( con: tcod.console.Console, x: int, y: int ) -> Color: """Return the foreground color at the x,y of this console. .. deprecated:: 8.4 Array access performs significantly faster than using this function. See :any:`Console.fg`. """ return Color._new_fro...
python
def console_get_char_foreground( con: tcod.console.Console, x: int, y: int ) -> Color: """Return the foreground color at the x,y of this console. .. deprecated:: 8.4 Array access performs significantly faster than using this function. See :any:`Console.fg`. """ return Color._new_fro...
[ "def", "console_get_char_foreground", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "Color", ":", "return", "Color", ".", "_new_from_cdata", "(", "lib", ".", "TCOD_console_get_char_foreground"...
Return the foreground color at the x,y of this console. .. deprecated:: 8.4 Array access performs significantly faster than using this function. See :any:`Console.fg`.
[ "Return", "the", "foreground", "color", "at", "the", "x", "y", "of", "this", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1597-L1608
9,194
libtcod/python-tcod
tcod/libtcodpy.py
console_get_char
def console_get_char(con: tcod.console.Console, x: int, y: int) -> int: """Return the character at the x,y of this console. .. deprecated:: 8.4 Array access performs significantly faster than using this function. See :any:`Console.ch`. """ return lib.TCOD_console_get_char(_console(con),...
python
def console_get_char(con: tcod.console.Console, x: int, y: int) -> int: """Return the character at the x,y of this console. .. deprecated:: 8.4 Array access performs significantly faster than using this function. See :any:`Console.ch`. """ return lib.TCOD_console_get_char(_console(con),...
[ "def", "console_get_char", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "int", ":", "return", "lib", ".", "TCOD_console_get_char", "(", "_console", "(", "con", ")", ",", "x", ",", "...
Return the character at the x,y of this console. .. deprecated:: 8.4 Array access performs significantly faster than using this function. See :any:`Console.ch`.
[ "Return", "the", "character", "at", "the", "x", "y", "of", "this", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1612-L1619
9,195
libtcod/python-tcod
tcod/libtcodpy.py
console_wait_for_keypress
def console_wait_for_keypress(flush: bool) -> Key: """Block until the user presses a key, then returns a new Key. Args: flush bool: If True then the event queue is cleared before waiting for the next event. Returns: Key: A new Key instance. .. deprecated:: 9.3 ...
python
def console_wait_for_keypress(flush: bool) -> Key: """Block until the user presses a key, then returns a new Key. Args: flush bool: If True then the event queue is cleared before waiting for the next event. Returns: Key: A new Key instance. .. deprecated:: 9.3 ...
[ "def", "console_wait_for_keypress", "(", "flush", ":", "bool", ")", "->", "Key", ":", "key", "=", "Key", "(", ")", "lib", ".", "TCOD_console_wait_for_keypress_wrapper", "(", "key", ".", "key_p", ",", "flush", ")", "return", "key" ]
Block until the user presses a key, then returns a new Key. Args: flush bool: If True then the event queue is cleared before waiting for the next event. Returns: Key: A new Key instance. .. deprecated:: 9.3 Use the :any:`tcod.event.wait` function to wait for ev...
[ "Block", "until", "the", "user", "presses", "a", "key", "then", "returns", "a", "new", "Key", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1639-L1654
9,196
libtcod/python-tcod
tcod/libtcodpy.py
console_from_file
def console_from_file(filename: str) -> tcod.console.Console: """Return a new console object from a filename. The file format is automactially determined. This can load REXPaint `.xp`, ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files. Args: filename (Text): The path to the file, as a s...
python
def console_from_file(filename: str) -> tcod.console.Console: """Return a new console object from a filename. The file format is automactially determined. This can load REXPaint `.xp`, ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files. Args: filename (Text): The path to the file, as a s...
[ "def", "console_from_file", "(", "filename", ":", "str", ")", "->", "tcod", ".", "console", ".", "Console", ":", "return", "tcod", ".", "console", ".", "Console", ".", "_from_cdata", "(", "lib", ".", "TCOD_console_from_file", "(", "filename", ".", "encode", ...
Return a new console object from a filename. The file format is automactially determined. This can load REXPaint `.xp`, ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files. Args: filename (Text): The path to the file, as a string. Returns: A new :any`Console` instance.
[ "Return", "a", "new", "console", "object", "from", "a", "filename", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1685-L1698
9,197
libtcod/python-tcod
tcod/libtcodpy.py
console_blit
def console_blit( src: tcod.console.Console, x: int, y: int, w: int, h: int, dst: tcod.console.Console, xdst: int, ydst: int, ffade: float = 1.0, bfade: float = 1.0, ) -> None: """Blit the console src from x,y,w,h to console dst at xdst,ydst. .. deprecated:: 8.5 ...
python
def console_blit( src: tcod.console.Console, x: int, y: int, w: int, h: int, dst: tcod.console.Console, xdst: int, ydst: int, ffade: float = 1.0, bfade: float = 1.0, ) -> None: """Blit the console src from x,y,w,h to console dst at xdst,ydst. .. deprecated:: 8.5 ...
[ "def", "console_blit", "(", "src", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "w", ":", "int", ",", "h", ":", "int", ",", "dst", ":", "tcod", ".", "console", ".", "Console", ",", "xdst", ":", ...
Blit the console src from x,y,w,h to console dst at xdst,ydst. .. deprecated:: 8.5 Call the :any:`Console.blit` method instead.
[ "Blit", "the", "console", "src", "from", "x", "y", "w", "h", "to", "console", "dst", "at", "xdst", "ydst", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1702-L1721
9,198
libtcod/python-tcod
tcod/libtcodpy.py
console_delete
def console_delete(con: tcod.console.Console) -> None: """Closes the window if `con` is the root console. libtcod objects are automatically garbage collected once they go out of scope. This function exists for backwards compatibility. .. deprecated:: 9.3 This function is not needed for no...
python
def console_delete(con: tcod.console.Console) -> None: """Closes the window if `con` is the root console. libtcod objects are automatically garbage collected once they go out of scope. This function exists for backwards compatibility. .. deprecated:: 9.3 This function is not needed for no...
[ "def", "console_delete", "(", "con", ":", "tcod", ".", "console", ".", "Console", ")", "->", "None", ":", "con", "=", "_console", "(", "con", ")", "if", "con", "==", "ffi", ".", "NULL", ":", "lib", ".", "TCOD_console_delete", "(", "con", ")", "warnin...
Closes the window if `con` is the root console. libtcod objects are automatically garbage collected once they go out of scope. This function exists for backwards compatibility. .. deprecated:: 9.3 This function is not needed for normal :any:`tcod.console.Console`'s. The root console s...
[ "Closes", "the", "window", "if", "con", "is", "the", "root", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1741-L1771
9,199
libtcod/python-tcod
tcod/libtcodpy.py
console_fill_foreground
def console_fill_foreground( con: tcod.console.Console, r: Sequence[int], g: Sequence[int], b: Sequence[int], ) -> None: """Fill the foregound of a console with r,g,b. Args: con (Console): Any Console instance. r (Sequence[int]): An array of integers with a length of width*heigh...
python
def console_fill_foreground( con: tcod.console.Console, r: Sequence[int], g: Sequence[int], b: Sequence[int], ) -> None: """Fill the foregound of a console with r,g,b. Args: con (Console): Any Console instance. r (Sequence[int]): An array of integers with a length of width*heigh...
[ "def", "console_fill_foreground", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "r", ":", "Sequence", "[", "int", "]", ",", "g", ":", "Sequence", "[", "int", "]", ",", "b", ":", "Sequence", "[", "int", "]", ",", ")", "->", "None", ...
Fill the foregound of a console with r,g,b. Args: con (Console): Any Console instance. r (Sequence[int]): An array of integers with a length of width*height. g (Sequence[int]): An array of integers with a length of width*height. b (Sequence[int]): An array of integers with a length ...
[ "Fill", "the", "foregound", "of", "a", "console", "with", "r", "g", "b", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1775-L1812