Card
Bases: Frame
A convenience wrapper for Frame with card styling.
Card is a Frame with surface='card' and show_border=True by default,
providing an elevated container with a visible border for grouping content.
Example
card = ttk.Card(app, padding=20)
ttk.Label(card, text="Card content").pack()
__init__
__init__(
master: Master = None, **kwargs: Unpack[CardKwargs]
) -> None
Create a themed Card container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
master
|
Master
|
Parent widget. If None, uses the default root window. |
None
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
padding |
int | tuple
|
Extra padding inside the card. Default 16. |
width |
int
|
Requested width in pixels. |
height |
int
|
Requested height in pixels. |
takefocus |
bool
|
Widget accepts focus during keyboard traversal. |
style |
str
|
Explicit ttk style name (overrides accent/variant). |
accent |
str
|
Accent/color token for the card. Default 'card'. |
variant |
str
|
Style variant (if applicable). |
surface |
str
|
Surface token for the parent background. |
show_border |
bool
|
Draw a border around the card. Default True. |
style_options |
dict
|
Optional dict forwarded to the style builder. |