Container

class tanmatsu.widgets.Container(*args, children: dict[str, tanmatsu.widgets.base.Widget], **kwargs)

Bases: Widget

A widget that can have children widgets. Abstract base class.

Parameters

children (dict[str, Widget]) – Dictionary containing child widgets. Keys are str (the names of the widgets) and values are Widget objects (the children).

add_child(name: str, widget: Widget)

Add a child object widget named name. If a widget with that name already exists, then the widget corresponding to the name is updated instead.

Parameters
  • name (str) – The name of the widget to add.

  • widget (Widget) – The widget object to add.

del_child_by_name(name: str)

Delete the child widget with name name.

Parameters

name (str) – The name of the widget to delete.

Raises

KeyError – if the name does not exist in the children.

del_child_by_widget(widget: Widget)

Delete the child widget.

Parameters

widget (Widget) – The widget object to delete.

Raises

KeyError – if the object widget does not exist in the children.