panedwindow(n)

πŸ’– panedwindow(n) β€” Tk Built-In Commands πŸ’–

okay so quick vibe check before we dive in: this is the panedwindow(n) page from the Tk Built-In Commands manual. It's a long one, so it's split across two parts β€” this is part 1, bestie. Buckle up. πŸŽ€


✨ NAME ✨

panedwindow β€” literally the command that creates and manipulates 'panedwindow' split container widgets. that's the whole job description. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

panedwindow pathName ?options?

🌸 STANDARD OPTIONS 🌸

these are the vanilla ones everyone gets:

  • -background
  • -borderwidth
  • -cursor
  • -orient
  • -relief
for the full tea on these, go check the options manual entry β€” it's got all the details. 🫢

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

these are the ones that give panedwindow its whole main character energy. each one comes with a Command-Line Name, a Database Name, and a Database Class β€” yes bestie, you're gonna see all three for every single one, no skips. πŸ’œ

  • -handlepad β€” so when sash handles are actually drawn, this says how far from the top or left end of the sash (which end depends on the orientation of the widget, iykyk) the handle gets drawn. may be any value accepted by Tk_GetPixels.
    • Database Name: handlePad
    • Database Class: HandlePad
  • -handlesize β€” sets the side length of a sash handle. handles are always drawn as squares, no exceptions, no rounded corners, periodt. may be any value accepted by Tk_GetPixels.
    • Database Name: handleSize
    • Database Class: HandleSize
  • -height β€” your desired height for the overall panedwindow widget. may be any value accepted by Tk_GetPixels. if you give it an empty string, the widget gets made high enough to let all the contained widgets have their natural height. πŸ¦‹
    • Database Name: height
    • Database Class: Height
  • -opaqueresize β€” the big question: do panes get resized as a sash is moved (true), or is that resizing deferred until the sash is actually placed (false)? in the second case, a "ghost" version of the sash shows up during resizing so you can see where the panes will land when you release the mouse button. that "ghost" version of the sash is the proxy, and you can configure how it renders using the -proxybackground, -proxyborderwidth and -proxyrelief options. lowkey obsessed with the ghost sash concept. πŸ‘»
    • Database Name: opaqueResize
    • Database Class: OpaqueResize
  • -proxybackground β€” the background color used when drawing the proxy. if it's an empty string, the value of the -background option gets used instead.
    • Database Name: proxyBackground
    • Database Class: ProxyBackground
  • -proxyborderwidth β€” the borderwidth of the proxy. may be any value accepted by Tk_GetPixels.
    • Database Name: proxyBorderWidth
    • Database Class: ProxyBorderWidth
  • -proxyrelief β€” the relief used when drawing the proxy. may be any of the standard Tk relief values. if it's an empty string, the value of the -sashrelief option gets used instead. slay, delegation. ✨
    • Database Name: proxyRelief
    • Database Class: ProxyRelief
  • -sashcursor β€” the mouse cursor to use when you're over a sash. if it's null, sb_h_double_arrow gets used for horizontal panedwindows, and sb_v_double_arrow gets used for vertical panedwindows.
    • Database Name: sashCursor
    • Database Class: SashCursor
  • -sashpad β€” how much padding to leave on each side of a sash. may be any value accepted by Tk_GetPixels.
    • Database Name: sashPad
    • Database Class: SashPad
  • -sashrelief β€” the relief used when drawing a sash. may be any of the standard Tk relief values.
    • Database Name: sashRelief
    • Database Class: SashRelief
  • -sashwidth β€” the width of each sash. may be any value accepted by Tk_GetPixels.
    • Database Name: sashWidth
    • Database Class: SashWidth
  • -showhandle β€” whether sash handles should be shown at all. may be any valid Tcl boolean value. πŸŽ€
    • Database Name: showHandle
    • Database Class: ShowHandle
  • -width β€” your desired width for the overall panedwindow widget. may be any value accepted by Tk_GetPixels. if you give it an empty string, the widget gets made wide enough to let all the contained widgets have their natural width.
    • Database Name: width
    • Database Class: Width

🌈 DESCRIPTION 🌈

the panedwindow command creates a brand-new window (the one you named in the pathName argument, bestie) and turns it into a panedwindow widget. you can drop additional options on the command line or in the option database β€” the ones described above β€” to configure stuff about the panedwindow like its default background color and relief. and then panedwindow returns the path name of the brand-new window. easy. 🫢

so a panedwindow widget contains any number of panes, laid out horizontally or vertically depending on whatever you set -orient to. each pane contains exactly one widget, and every pair of panes is separated by a sash that's moveable β€” via mouse movements, obviously. moving a sash causes the widgets on either side of that sash to be resized. it's giving split-screen main character energy, fr fr. πŸ”₯


πŸ’… WIDGET COMMAND πŸ’…

okay so the panedwindow command creates a new Tcl command whose name is the same as the path name of the panedwindow'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 panedwindow widget's path name. Option and the args determine the exact behavior of the command. The following commands are possible for panedwindow widgets:

  • pathName add window ?window ...? ?option value ...? β€” adds one or more windows to the panedwindow, each in a separate pane. The arguments are the names of one or more windows, followed by pairs of arguments that specify how to manage the windows. Option may have any of the values accepted by the configure subcommand.
  • pathName cget option β€” returns the current value of the configuration option given by option. option may have any of the values accepted by the panedwindow command.
  • pathName configure ?option? ?value option value ...? β€” queries or modifies the configuration options of the widget. If no option is specified, it 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 panedwindow command.
  • pathName forget window ?window ...? β€” removes the pane containing window from the panedwindow. All geometry management options for window will be forgotten. bye bestie πŸ‘‹
  • pathName identify x y β€” identifies the panedwindow component underneath the point given by x and y, in window coordinates. If the point is over a sash or a sash handle, the result is a two element list containing the index of the sash or handle, and a word indicating whether it is over a sash or a handle, such as {0 sash} or {2 handle}. If the point is over any other part of the panedwindow, the result is an empty list.
  • pathName panecget window option β€” queries a management option for window. Option may be any value allowed by the paneconfigure subcommand.
  • pathName paneconfigure window ?option? ?value option value ...? β€” queries or modifies the management options for window. If no option is specified, it 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. The following options are supported:
    • -after window β€” insert the window after the window specified. window should be the name of a window already managed by pathName.
    • -before window β€” insert the window before the window specified. window should be the name of a window already managed by pathName.
    • -height size β€” specify a height for the window. The height will be the outer dimension of the window including its border, if any. If size is an empty string, or if -height is not specified, then the height requested internally by the window will be used initially; the height may later be adjusted by the movement of sashes in the panedwindow. Size may be any value accepted by Tk_GetPixels.
    • -hide boolean β€” controls the visibility of a pane. When the boolean is true (according to Tcl_GetBoolean) the pane will not be visible, but it will still be maintained in the list of panes. sneaky hidden icon behavior ✨
    • -minsize n β€” specifies that the size of the window cannot be made less than n. This constraint only affects the size of the widget in the paned dimension β€” the x dimension for horizontal panedwindows, the y dimension for vertical panedwindows. May be any value accepted by Tk_GetPixels.
    • -padx n β€” specifies a non-negative value indicating how much extra space to leave on each side of the window in the X-direction. The value may have any of the forms accepted by Tk_GetPixels.
    • -pady n β€” specifies a non-negative value indicating how much extra space to leave on each side of the window in the Y-direction. The value may have any of the forms accepted by Tk_GetPixels.
    • -sticky style β€” if a window's pane is larger than the requested dimensions of the window, this option may be used to position (or stretch) the window within its pane. Style is a string that contains zero or more of the characters n, s, e or w. The string can optionally contain spaces or commas, but they are ignored. Each letter refers to a side (north, south, east, or west) that the window will β€œstick” to. If both n and s (or e and w) are specified, the window will be stretched to fill the entire height (or width) of its cavity.
    • -stretch when β€” controls how extra space is allocated to each of the panes. When is one of always, first, last, middle, and never. The panedwindow will calculate the required size of all its panes. Any remaining (or deficit) space will be distributed to those panes marked for stretching. The space will be distributed based on each pane's current ratio of the whole. The when values have the following definitions:
      • always β€” This pane will always stretch.
      • first β€” Only if this pane is the first pane (left-most or top-most) will it stretch.
      • last β€” Only if this pane is the last pane (right-most or bottom-most) will it stretch. This is the default value.
      • middle β€” Only if this pane is not the first or last pane will it stretch.
      • never β€” This pane will never stretch.
    • -width size β€” specify a width for the window. The width will be the outer dimension of the window including its border, if any. If size is an empty string, or if -width is not specified, then the width requested internally by the window will be used initially; the width may later be adjusted by the movement of sashes in the panedwindow. Size may be any value accepted by Tk_GetPixels.
  • pathName panes β€” returns an ordered list of the widgets managed by pathName.
  • pathName proxy ?args? β€” this command is used to query and change the position of the sash proxy, used for rubberband-style pane resizing. It can take any of the following forms:
    • pathName proxy coord β€” return a list containing the x and y coordinates of the most recent proxy location.
    • pathName proxy forget β€” remove the proxy from the display.
    • pathName proxy place x y β€” place the proxy at the given x and y coordinates.
  • pathName sash ?args? β€” this command is used to query and change the position of sashes in the panedwindow. It can take any of the following forms:
    • pathName sash coord index β€” return the current x and y coordinate pair for the sash given by index. Index must be an integer between 0 and 1 less than the number of panes in the panedwindow. The coordinates given are those of the top left corner of the region containing the sash.
    • pathName sash dragto index x y β€” this command computes the difference between the given coordinates and the coordinates given to the last sash mark command for the given sash. It then moves that sash the computed difference. The return value is the empty string.
    • pathName sash mark index x y β€” records x and y for the sash given by index; used in conjunction with later sash dragto commands to move the sash.
    • pathName sash place index x y β€” place the sash given by index at the given coordinates.

πŸ¦‹ RESIZING PANES πŸ¦‹

A pane is resized by grabbing the sash (or sash handle if present) and dragging with the mouse. This is accomplished via mouse motion bindings on the widget. When a sash is moved, the sizes of the panes on each side of the sash, and thus the widgets in those panes, are adjusted. drag queen behavior but make it geometry πŸ’…

When a pane is resized from outside (e.g. it is packed to expand and fill, and the containing toplevel is resized), space is added to the final (rightmost or bottommost) pane in the window.

Unlike child windows managed by e.g. pack or grid, the panes managed by a panedwindow do not change width or height to accommodate changes in the requested widths or heights of the panes, once these have become mapped. Therefore it may be advisable, particularly when creating layouts interactively, to not add a pane to the panedwindow widget until after the geometry requests of that pane has been finalized (i.e., all components of the pane inserted, all options affecting geometry set to their proper values, etc.). fr fr, set it up first, then add it 🫢


🌈 SEE ALSO 🌈

  • ttk::panedwindow(n)

πŸ“ KEYWORDS πŸ“

panedwindow, widget, geometry management


okay bye bestie πŸ’– this page is from Tk 8.4, panedwindow(n), and the footer doesn't list a date β€” so that's the source/version tea, periodt πŸŽ€βœ¨

πŸ“¦ where this page comes from