functui.io.raw

Cross platform input and output implemintation.

class functui.io.raw.RawInputParserState(*values)[source]
class functui.io.raw.TerminalContext(features: TerminalFeatures, stdin: TextIO, stdout: TextIO)[source]
class functui.io.raw.TerminalFeatures(mouse: bool = False, bracketed_paste: bool = False, alternate_screen: bool = False, line_wrap: bool = True, hidden_cursor: bool = False)[source]
class functui.io.raw.TerminalIO(event_queue: SimpleQueue[InputEvent], stdout: TextIO)[source]

Terminal input output object that has both windows and unix implemintions.

See also

You are unlikely to create this object yourself, use terminal() instead.

block_until_input(ignore_excess_mouse: bool = True) InputEvent[source]

Wait until user causes an input event and then return it. :param ignore_excess_mouse: Sometimes ui does not render in time due to an event being

emmited for every cell a mouse moves over. In this case, skip over mouse events that we don’t have the time to render.

display_result(res: Result)[source]

Display a result generated from a functui.classes.Layout.

The preffered way to display layouts.

abstractmethod get_terminal_size() Rect[source]

Get terminal size.

abstractmethod print(ansi_data: str)[source]

Write a string with ansi codes to output and flush.

See also

For performance reasons, it is recommended to use TerminalIO.display_result() instead.

class functui.io.raw.UnixTerminalContext(features: TerminalFeatures, stdin: TextIO, stdout: TextIO)[source]
class functui.io.raw.UnixTerminalIO(event_queue: SimpleQueue[InputEvent], stdout: TextIO)[source]
get_terminal_size() Rect[source]

Get terminal size.

print(ansi_data: str)[source]

Write a string with ansi codes to output and flush.

See also

For performance reasons, it is recommended to use TerminalIO.display_result() instead.

class functui.io.raw.WindowsTerminalContext(features: TerminalFeatures, stdin: TextIO, stdout: TextIO)[source]
class functui.io.raw.WindowsTerminalIO(event_queue: SimpleQueue[InputEvent], stdout: TextIO)[source]
get_terminal_size() Rect[source]

Get terminal size.

print(ansi_data: str)[source]

Write a string with ansi codes to output and flush.

See also

For performance reasons, it is recommended to use TerminalIO.display_result() instead.

functui.io.raw.terminal(features: TerminalFeatures = TerminalFeatures(mouse=True, bracketed_paste=True, alternate_screen=True, line_wrap=True, hidden_cursor=True))[source]

Create a TerminalContext for the appropriate environment.