Karana.KUtils.MultibodyTUI.base#

Contains TUIBase, a base class for TUIs.

Classes#

TUIBase

Base class for terminal user interfaces.

Module Contents#

class Karana.KUtils.MultibodyTUI.base.TUIBase(*, run=True)[source]#

Bases: abc.ABC

Base class for terminal user interfaces.

abstract redraw()[source]#

Redraw the TUI.

A concrete TUI class must implement this method

Typically the implementation should first clear the screen then print the TUI interface.

abstract handleKey(key: str) bool[source]#

Handle a single key press.

A concrete TUI class must implement this method

Parameters:

key (str) – The pressed key as returned by pollKey

Returns:

Return False to indicate the TUI should exit

Return type:

bool

run()[source]#

Run the TUI, driven by redraw and handleKey.

This will take control of the main thread unless interrupted or until handleKey returns True.