Skip to content

Badge

Bases: Label

bootstack wrapper for ttk.Label that renders with a badge style.

__init__

__init__(
    master: Master = None, **kwargs: Unpack[LabelKwargs]
)

Create a themed bootstack Badge.

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 badge.

image PhotoImage

Image to display.

icon str | dict

Theme-aware icon spec handled by the style system.

icon_only bool

If True, removes the additional padding reserved for label text.

compound str

Placement of the image relative to text.

anchor str

Alignment of the badge content within its area.

justify str

How to justify multiple lines of text.

localize bool | Literal[auto]

Determines the widget's localization mode.

value_format str | dict

Format specification for the badge value.

padding int | tuple

Extra space around the badge content.

width int

Width of the badge in characters.

wraplength int

Maximum width before wrapping text.

font str | Font

Font for the badge text.

foreground str

Text color.

background str

Background color.

relief str

Border style.

state str

Widget state.

takefocus bool

Whether the widget participates in focus traversal.

style str

Explicit ttk style name (overrides accent/variant).

accent str

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

variant str

Shape of badge. 'pill' or 'square' (default).

surface str

Optional surface token; otherwise inherited.

style_options dict

Optional dict forwarded to the style builder.