bec_widgets.examples.jupyter_console.jupyter_console_window#

Attributes#

Classes#

JupyterConsoleWindow

A widget that contains a Jupyter console linked to BEC Widgets with full API access.

Module Contents#

class JupyterConsoleWindow(parent=None, *args, **kwargs)#

Bases: qtpy.QtWidgets.QWidget

A widget that contains a Jupyter console linked to BEC Widgets with full API access.

Features: - Add widgets dynamically from the UI (top-right panel) or from the console via jc.add_widget(…). - Add BEC widgets by registered type via a combo box or jc.add_widget_by_type(…). - Each added widget appears as a new tab in the left tab widget and is exposed in the console under the chosen shortcut. - Hardcoded example tabs removed; two examples are added programmatically at startup in the __main__ block.

_init_ui()#
_instantiate_from_class_path(class_path: str, kwargs: dict | None = None) qtpy.QtWidgets.QWidget#
_on_add_registered_clicked()#
_on_add_widget_clicked()#
_populate_registry_widgets()#
_push_to_console(mapping: Dict[str, Any])#

Push Python objects into the inprocess kernel user namespace.

add_widget(widget: qtpy.QtWidgets.QWidget, shortcut: str, title: str | None = None) qtpy.QtWidgets.QWidget#

Add a QWidget as a new tab and expose it in the Jupyter console.

  • widget: a QWidget instance to host in a new tab

  • shortcut: variable name used in the console to access it

  • title: optional tab title (defaults to shortcut or class name)

add_widget_by_class_path(class_path: str, shortcut: str, kwargs: dict | None = None, title: str | None = None) qtpy.QtWidgets.QWidget#
add_widget_by_type(widget_type: str, shortcut: str, kwargs: dict | None = None, title: str | None = None) qtpy.QtWidgets.QWidget#

Instantiate a registered BEC widget by its type string and add it as a tab.

If kwargs does not contain object_name, it will default to the provided shortcut.

closeEvent(event)#

Override to handle things when main window is closed.

module_path#