Karana.KUtils.MultibodyTUI.base#

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 handle_key(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 poll_key

Returns:

Return False to indicate the TUI should exit

Return type:

bool

run()[source]#

Run the TUI, driven by redraw and handle_key

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