ttk::labelframe(3tk)

πŸ“¦
version 9.0.4 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

okay so bestie, this is ttk::labelframe from the ttk widget family β€” it's a container widget with an optional label. that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

ttk::labelframe pathName ?options?

πŸŽ€ DESCRIPTION πŸŽ€

so a ttk::labelframe widget is a container β€” like, its whole job is to group other widgets together so your UI doesn't look like a chaotic group chat with no pinned messages. 🫢

it has an optional label, and that label can be a plain text string OR it can be an actual other widget. icon behaviour honestly.


πŸ’– STANDARD OPTIONS πŸ’–

these are the ones it inherits, no notes:

  • -class
  • -cursor
  • -padding
  • -style
  • -takefocus

the ttk_widget manual entry has the details on all the standard options β€” go read that bestie, it's giving reference material. πŸ“š


πŸ‘‘ WIDGET-SPECIFIC OPTIONS πŸ‘‘

-height

Command-Line Name: -height Database Name: height Database Class: Height

if you specify it, this is the widget's requested height in pixels. (peep ttk::frame(3tk) for further notes on -width and -height, they're in the same lore.) ✨

-labelanchor

Command-Line Name: -labelanchor Database Name: labelAnchor Database Class: LabelAnchor

this one says where to place the label. the allowed values, going clockwise from the top upper left corner, are:

nw, n, ne, en, e, es, se, s, sw, ws, w and wn

the default value is theme-dependent β€” so like, it depends on your theme, not on your mood. πŸ™ˆ

-labelwidget

Command-Line Name: -labelwidget Database Name: labelWidget Database Class: LabelWidget

the name of a widget to use for the label. if you set this, it overrides the -text option. periodt.

heads up: the -labelwidget must be a child of the labelframe widget or one of the labelframe's ancestors, and it must belong to the same top-level widget as the labelframe. no cross-top-level nonsense allowed. 🚫

-text

Command-Line Name: -text Database Name: text Database Class: Text

specifies the text of the label. that's it, that's the option. πŸ’œ

-underline

Command-Line Name: -underline Database Name: underline Database Class: Underline

if set, this is the integer index (0-based) of a character to underline in the text string. that underlined character is what you use for mnemonic activation. 🧚

and here's the cute part: mnemonic activation for a ttk::labelframe sets the keyboard focus to the first child of the ttk::labelframe widget. keyboard girlies, this one's for you. ⌨️

-width

Command-Line Name: -width Database Name: width Database Class: Width

if specified, the widget's requested width in pixels. slay.


πŸ¦‹ WIDGET COMMAND πŸ¦‹

Labelframe widgets support the standard commands β€” nothing extra, nothing hidden:

  • cget
  • configure
  • identify element
  • instate
  • state
  • style

(see ttk::widget for the deets on all of those.)


🌈 STYLING OPTIONS 🌈

okay this is the fun part. the class name for a ttk::labelframe is TLabelframe. the text label has a class of TLabelframe.Label. two classes, two glow-ups. πŸ’…

Dynamic states: disabled, readonly.

TLabelframe styling options configurable with ttk::style

  • -background color
  • -bordercolor color
  • -borderwidth amount
  • -darkcolor color
  • -labelmargins amount
  • -labeloutside boolean
  • -lightcolor color
  • -relief relief

TLabelframe.Label styling options configurable with ttk::style

  • -background color
  • -font font
  • -foreground color
some options are only available for specific themes. so if an option is ghosting you, check your theme bestie. πŸ‘»

see the ttk::style manual page for information on how to configure ttk styles. πŸ“–


πŸ“ SEE ALSO πŸ“


⭐ KEYWORDS ⭐

widget, frame, container, label, groupbox


and that's the whole page, bestie! 🫢 this was ttk::labelframe from Tk 8.5, documented back in the day β€” the footer says ttk::labelframe(3tk) and honestly it ate. go build something cute with it. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from