Skip to content

Button

Bases: LocalizationMixin, TextSignalMixin, IconMixin, TTKWrapperBase, WidgetCapabilitiesMixin, TtkStateMixin, Button

TTK Bootstrap Button

bootstack wrapper for ttk.Button with bootstyle and icon support.

__init__

__init__(
    master: Master = None, **kwargs: Unpack[ButtonKwargs]
) -> None

Create a themed bootstack Button.

Parameters:

Name Type Description Default
master Master

Parent widget. If None, uses the default root window.

None

Other Parameters:

Name Type Description
text str

Text to display on the button.

textvariable Variable

Tk variable linked to the button text.

textsignal Signal[str]

Reactive Signal linked to the button text (auto-synced with textvariable).

command Callable

Callable invoked when the button is pressed.

image PhotoImage

Image to display on the button.

icon str | dict

Optional icon spec integrated via the style system.

icon_only bool

If true, removes the extra padding reserved for the text labels.

compound str

Placement of the image relative to text (e.g., 'left').

padding int | tuple

Extra space around the button content.

anchor str

Determines how the content is aligned in the container. Combination of 'n', 's', 'e', 'w', or 'center' (default).

localize bool | Literal['auto']

Determines the widgets localization mode.

width int

Width of the button in characters.

underline int

Index of the character to underline in text.

state str

Widget state (e.g., 'normal', 'disabled').

takefocus bool

Whether the widget accepts focus during traversal.

style str

Explicit ttk style name to apply (overrides accent/variant).

accent str

Accent token for styling, e.g. 'primary', 'danger', 'success'.

variant str

Style variant, e.g. 'solid', 'outline', 'link', 'text'. Defaults to 'solid'.

density str

The vertical and horizontal compactness of widget content, e.g. 'default', 'compact'.

bootstyle str

DEPRECATED - Use accent and variant instead.

surface str

Optional surface token to use for this button; if not provided, surface color is inherited from the parent.

style_options dict

Optional dict forwarded to the style builder.