frame(n)

🌸 frame(n) β€” the Tk Built-In Commands era πŸ’…

okay bestie, so this is frame(n), straight out of the Tk Built-In Commands collection, and it's literally the most chill widget in the whole toolkit. let's get into it 🫢


✨ NAME ✨

frame β€” create and manipulate 'frame' simple container widgets. that's it, that's the vibe. a lil box. a lil guy. a container. iconic. πŸ’–


✨ SYNOPSIS ✨

frame pathName ?options?

✨ STANDARD OPTIONS ✨

these are the standard ones, no cap:

  • -borderwidth
  • -cursor
  • -highlightbackground
  • -highlightcolor
  • -highlightthickness
  • -padx
  • -pady
  • -relief
  • -takefocus

heads up bestie: see the options manual entry for the details on all the standard options. i'm not gatekeeping, i'm just pointing you to the source πŸ’…


✨ WIDGET-SPECIFIC OPTIONS ✨

okay these are the ones that make frame frame. the main character options πŸŽ€

  • -background β€” Command-Line Name: -background; Database Name: background; Database Class: Background

this is the same as the standard -background option, EXCEPT that its value can also be an empty string. and if it IS an empty string? the widget displays no background or border at all, and no colors will be consumed from its colormap for its background and border. also β€” an empty background will disable drawing the background image. so yeah, empty string = full ghost mode πŸ‘»

  • -backgroundimage β€” Command-Line Name: -backgroundimage; Database Name: backgroundImage; Database Class: BackgroundImage

this one specifies an image to display on the frame's background, and it lives within the border of the frame (so like, the image gets clipped by the frame's highlight ring and border, if either of those are present). subwidgets of the frame get drawn on top of it, slay. the image has to have been created with the image create command. if you specify it as the empty string, no image will be displayed. periodt.

  • -class β€” Command-Line Name: -class; Database Name: class; Database Class: Class

specifies a class for the window. this class gets used when querying the option database for the window's other options, and it'll also get used later for other purposes like bindings. the -class option may not be changed with the configure widget command. nope. locked in. πŸ”’

  • -colormap β€” Command-Line Name: -colormap; Database Name: colormap; Database Class: Colormap

specifies a colormap to use for the window. the value can be either new β€” in which case a new colormap is created for the window and its children β€” or the name of another window (which has to be on the same screen and have the same visual as pathName), in which case the new window will use the colormap from that specified window. if -colormap isn't specified, the new window uses the same colormap as its parent. this option may not be changed with the configure widget command. fr fr.

  • -container β€” Command-Line Name: -container; Database Name: container; Database Class: Container

the value must be a boolean. if true, it means this window will be used as a container where some other application gets embedded (for example, a Tk toplevel can be embedded using the -use option). the window will support the appropriate window manager protocols for stuff like geometry requests. the window should not have any children of its own in this application. this option may not be changed with the configure widget command. also note: -borderwidth, -padx and -pady are ignored when configured as a container, since a container has no border. the way that a container just. has no border. 😭

  • -height β€” Command-Line Name: -height; Database Name: height; Database Class: Height

specifies the desired height for the window, in any of the forms acceptable to Tk_GetPixels. if this option is negative or zero, then the window won't request any size at all. note that this sets the total height of the frame β€” any -borderwidth or similar is not added. normally -height should not be used if a propagating geometry manager, such as grid or pack, is used within the frame, since the geometry manager will override the height of the frame. so like, pick a lane bestie πŸ¦‹

  • -tile β€” Command-Line Name: -tile; Database Name: tile; Database Class: Tile

this specifies how to draw the background image (see -backgroundimage) on the frame. if true (according to Tcl_GetBoolean), the image will be tiled to fill the whole frame, with the origin of the first copy of the image being the top left of the interior of the frame. if false (the default), the image will be centered within the frame. centered! like me in every group photo πŸ’…

  • -visual β€” Command-Line Name: -visual; Database Name: visual; Database Class: Visual

specifies visual information for the new window, in any of the forms accepted by Tk_GetVisual. if this option isn't specified, the new window uses the same visual as its parent. the -visual option may not be modified with the configure widget command. don't even try it.

  • -width β€” Command-Line Name: -width; Database Name: width; Database Class: Width

specifies the desired width for the window, in any of the forms acceptable to Tk_GetPixels. if this option is negative or zero, then the window won't request any size at all. note that this sets the total width of the frame β€” any -borderwidth or similar is not added. normally -width should not be used if a propagating geometry manager, such as grid or pack, is used within the frame, since the geometry manager will override the width of the frame. same energy as -height, just horizontal πŸŽ€


✨ DESCRIPTION ✨

the frame command creates a new window (given by the pathName argument) and makes it into a frame widget. additional options, described above, may be specified on the command line or in the option database to configure aspects of the frame such as its background color and relief. the frame command returns the path name of the new window. 🫢

a frame is a simple widget. its primary purpose is to act as a spacer or container for complex window layouts. the only features of a frame are its background and an optional 3-D border to make the frame appear raised or sunken. that's literally the whole thing. lowkey iconic for how unbothered it is πŸ’œ


✨ WIDGET COMMAND ✨

the frame command creates a new Tcl command whose name is the same as the path name of the frame's window. this command may be used to invoke various operations on the widget. it has the following general form:

pathName option ?arg ...?

pathName is the name of the command, which is the same as the frame widget's path name. option and the args determine the exact behavior of the command. the following commands are possible for frame widgets:

  • pathName cget option

returns the current value of the configuration option given by option. option may have any of the values accepted by the frame command.

  • pathName configure ?option? ?value option value ...?

query or modify the configuration options of the widget. if no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). if option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). if one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. option may have any of the values accepted by the frame command.


✨ BINDINGS ✨

when a new frame is created, it has no default event bindings: frames are not intended to be interactive. not interactive!! it's giving decorative. it's giving structural support. it's giving load-bearing bestie πŸ’…βœ¨


✨ SEE ALSO ✨


✨ KEYWORDS ✨

frame, widget


and that's the whole page bestie!! 🌈 this one's running on Tk 8.4 β€” big 8.4 energy, the manual section is frame(n), and that's genuinely the entire thing. go build a layout, you've got this πŸ’–πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from
  • fedora 43: tk 1:9.0.2-2.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
  • fedora 43: tk 1:9.0.2-2.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
  • fedora 44: tk 1:9.0.2-2.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
  • fedora 44: tk 1:9.0.2-2.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms