Karana.KUtils.MultibodyTUI.base
===============================

.. py:module:: Karana.KUtils.MultibodyTUI.base

.. autoapi-nested-parse::

   Contains TUIBase, a base class for TUIs.



Classes
-------

.. autoapisummary::

   Karana.KUtils.MultibodyTUI.base.TUIBase


Module Contents
---------------

.. py:class:: TUIBase(*, run=True)

   Bases: :py:obj:`abc.ABC`


   Base class for terminal user interfaces.


   .. py:method:: redraw()
      :abstractmethod:


      Redraw the TUI.

      A concrete TUI class must implement this method

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



   .. py:method:: handleKey(key: str) -> bool
      :abstractmethod:


      Handle a single key press.

      A concrete TUI class must implement this method

      :param key: The pressed key as returned by pollKey
      :type key: str

      :returns: Return False to indicate the TUI should exit
      :rtype: bool



   .. py:method:: run()

      Run the TUI, driven by redraw and handleKey.

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



