ttk::sizegrip(n)

πŸ’… ttk::sizegrip(n) πŸ’…

okay so bestie, this is a page from the Tk Themed Widget manual set β€” the ttk::sizegrip page, to be exact. sit down, grab a strawberry drink πŸ“, and let's get into it.


✨ NAME ✨

ttk::sizegrip β€” the bottom-right corner resize widget, aka the little grabby thing that lets you stretch a window πŸ’–


✨ SYNOPSIS ✨

ttk::sizegrip pathName ?options?

✨ DESCRIPTION ✨

A ttk::sizegrip widget β€” also known as a grow box, iconic name honestly β€” lets the user resize the toplevel window that contains it by pressing and dragging the grip. That's it. That's the whole vibe. press, drag, window gets bigger. 🫢


✨ STANDARD OPTIONS ✨

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

no cap, for the full deets on these, go check the ttk_widget manual entry β€” it's the source of truth πŸ’…


✨ WIDGET COMMAND ✨

Sizegrip widgets support the standard commands, and yes these are literally the names, keep them exact:

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

(see ttk::widget for all of those, iykyk ✨)


✨ PLATFORM-SPECIFIC NOTES ✨

On macOS, toplevel windows automatically include a built-in size grip by default. So adding a ttk::sizegrip there is harmless β€” the built-in grip just masks the widget. like, it's fine, nobody's mad, the built-in one is just standing in front of yours πŸ™ˆ


✨ EXAMPLES ✨

Using pack β€” the classic:

pack [ttk::frame $top.statusbar] -side bottom -fill x
pack [ttk::sizegrip $top.statusbar.grip] -side right -anchor se

Using grid β€” for the layout girlies:

grid [ttk::sizegrip $top.statusbar.grip] \
    -row $lastRow -column $lastColumn -sticky se
# ... optional: add vertical scrollbar in $lastColumn,
# ... optional: add horizontal scrollbar in $lastRow

✨ BUGS ✨

okay listen, two things, and they're both real 😭

  • If the containing toplevel's position was specified relative to the right or bottom of the screen (e.g., wm geometry ... wxh-x-y instead of wm geometry ... wxh+x+y), the sizegrip widget will not resize the window. fr fr, it just won't.
  • ttk::sizegrip widgets only support "southeast" resizing. that's the whole range of motion, bestie. one corner. periodt.

✨ STYLING OPTIONS ✨

The class name for a ttk::sizegrip is TSizegrip πŸ‘‘

TSizegrip styling options configurable with ttk::style are:

  • -background color

Some options are only available for specific themes β€” so don't come for me if yours is missing something, check your theme first πŸŽ€

See the ttk::style manual page for the tea on how to configure ttk styles.


✨ SEE ALSO ✨

  • ttk::widget(n)

✨ KEYWORDS ✨

  • widget
  • sizegrip
  • grow box

and that's the page!! mwah πŸ’‹ this was brought to you by Tk version 8.5 and the ttk::sizegrip(n) corner of the manual β€” go forth and resize responsibly, bestie πŸŒˆπŸ’œ

πŸ“¦ where this page comes from