Skip to content

Bootstyle

Widget integration layer for bootstyle functionality.

Wires bootstack into tkinter/ttk by overriding widget constructors and configure methods to accept bootstyle parameter.

create_ttk_style staticmethod

create_ttk_style(
    widget_class: str,
    style_options: Optional[dict] = None,
    *,
    accent: Optional[str] = None,
    variant: Optional[str] = None,
) -> str

Create or get TTK style name for a widget.

Parameters:

Name Type Description Default
widget_class str

TTK widget class (e.g., "TButton")

required
style_options Optional[dict]

Custom style options dict

None
accent Optional[str]

Accent token (e.g., "success", "primary[subtle]")

None
variant Optional[str]

Variant name (e.g., "outline", "solid")

None

Returns:

Type Description
str

Generated TTK style name

override_ttk_widget_constructor staticmethod

override_ttk_widget_constructor(func)

Override ttk widget init to accept bootstyle, accent, and variant parameters.

override_tk_widget_constructor staticmethod

override_tk_widget_constructor(func)

Override Tk widget init to apply theme background when autostyle=True.