Karana.WebUI.console
====================

.. py:module:: Karana.WebUI.console

.. autoapi-nested-parse::

   Interactive, in-process Python console widget for Karana.WebUI.



Classes
-------

.. autoapisummary::

   Karana.WebUI.console.WebConsoleWidget


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

.. py:class:: WebConsoleWidget(router: Karana.WebUI.Router, namespace: dict[str, Any] | None = None, *, capture_c_output: bool = True, max_transcript_bytes: int = 1024 * 1024)

   Compose an interactive Python session with a real ``Karana.WebUI.Widget``.


   .. py:attribute:: widget


   .. py:method:: addToDomRoot() -> None

      Attach the underlying widget to WebUI's document root.



   .. py:method:: close() -> None

      Stop the session and restore streams installed by this widget.



   .. py:method:: __enter__() -> WebConsoleWidget

      Return this widget for context-managed use.



   .. py:method:: __exit__(_exception_type: type[BaseException] | None, _exception: BaseException | None, _traceback: types.TracebackType | None) -> None

      Restore process state when leaving a context manager.



