panedwindow(3tk)

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

✨ NAME ✨

panedwindow β€” create and manipulate panedwindow split container widgets. This one lives in the Tk Built-In Commands manual as panedwindow(3tk). πŸ’–

🌸 SYNOPSIS 🌸

panedwindow pathName ?options?

πŸ’– STANDARD OPTIONS πŸ’–

These are the standard options, bestie:

  • -background
  • -borderwidth
  • -cursor
  • -orient
  • -relief

See the options manual entry for details on the standard options.

πŸŽ€ WIDGET-SPECIFIC OPTIONS πŸŽ€

Okay so here's the whole menu of widget-specific options. Every command-line name, database name, and database class is staying, no cap.

  • -handlepad β€” Command-Line Name: -handlepad; Database Name: handlePad; Database Class: HandlePad. When sash handles are drawn, specifies the distance from the top or left end of the sash (depending on the orientation of the widget) at which to draw the handle. May be any value accepted by Tk_GetPixels.
  • -handlesize β€” Command-Line Name: -handlesize; Database Name: handleSize; Database Class: HandleSize. Specifies the side length of a sash handle. Handles are always drawn as squares. May be any value accepted by Tk_GetPixels.
  • -height β€” Command-Line Name: -height; Database Name: height; Database Class: Height. Specifies a desired height for the overall panedwindow widget. May be any value accepted by Tk_GetPixels. If an empty string, the widget will be made high enough to allow all contained widgets to have their natural height.
  • -opaqueresize β€” Command-Line Name: -opaqueresize; Database Name: opaqueResize; Database Class: OpaqueResize. Specifies whether panes should be resized as a sash is moved (true), or if resizing should be deferred until the sash is placed (false). In the latter case, a β€œghost” version of the sash is displayed during the resizing to show where the panes will be resized to when releasing the mouse button. This β€œghost” version of the sash is the proxy. Its rendering can be configured using the -proxybackground, -proxyborderwidth and -proxyrelief options.
  • -proxybackground β€” Command-Line Name: -proxybackground; Database Name: proxyBackground; Database Class: ProxyBackground. Background color to use when drawing the proxy. If an empty string, the value of the -background option will be used.
  • -proxyborderwidth β€” Command-Line Name: -proxyborderwidth; Database Name: proxyBorderWidth; Database Class: ProxyBorderWidth. Specifies the borderwidth of the proxy. May be any value accepted by Tk_GetPixels.
  • -proxyrelief β€” Command-Line Name: -proxyrelief; Database Name: proxyRelief; Database Class: ProxyRelief. Relief to use when drawing the proxy. May be any of the standard Tk relief values. If an empty string, the value of the -sashrelief option will be used.
  • -sashcursor β€” Command-Line Name: -sashcursor; Database Name: sashCursor; Database Class: SashCursor. Mouse cursor to use when over a sash. If null, sb_h_double_arrow will be used for horizontal panedwindows, and sb_v_double_arrow will be used for vertical panedwindows.
  • -sashpad β€” Command-Line Name: -sashpad; Database Name: sashPad; Database Class: SashPad. Specifies the amount of padding to leave of each side of a sash. May be any value accepted by Tk_GetPixels.
  • -sashrelief β€” Command-Line Name: -sashrelief; Database Name: sashRelief; Database Class: SashRelief. Relief to use when drawing a sash. May be any of the standard Tk relief values.
  • -sashwidth β€” Command-Line Name: -sashwidth; Database Name: sashWidth; Database Class: SashWidth. Specifies the width of each sash. May be any value accepted by Tk_GetPixels.
  • -showhandle β€” Command-Line Name: -showhandle; Database Name: showHandle; Database Class: ShowHandle. Specifies whether sash handles should be shown. May be any valid Tcl boolean value.
  • -width β€” Command-Line Name: -width; Database Name: width; Database Class: Width. Specifies a desired width for the overall panedwindow widget. May be any value accepted by Tk_GetPixels. If an empty string, the widget will be made wide enough to allow all contained widgets to have their natural width.

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so the panedwindow command creates a new window (that's your pathName argument) and makes it into a panedwindow widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the panedwindow such as its default background color and relief. The panedwindow command returns the path name of the new window. πŸ’…

A panedwindow widget contains any number of panes, arranged horizontally or vertically, according to the value of the -orient option. Each pane contains one widget, and each pair of panes is separated by a moveable (via mouse movements) sash. Moving a sash causes the widgets on either side of the sash to be resized. πŸ¦‹

πŸ’… WIDGET COMMAND πŸ’…

Okay bestie, so the panedwindow command makes a brand-new Tcl command, and that command's name is literally the same as the path name of the panedwindow's window. Wild, I know. You use this command to do all the operations on the widget. General form goes like this:

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 decide exactly what happens. Here are the commands a panedwindow widget can do for you πŸ‘‡


  • pathName add window ?window ...? ?option value ...? β€” adds one or more windows to the panedwindow, each one getting its own separate pane 🫢. The arguments are the names of one or more windows, followed by pairs of arguments that say how to manage those windows. Option can be any of the values that the configure subcommand accepts.
  • pathName cget option β€” hands you back the current value of the configuration option given by option. Option can be any value that the panedwindow command accepts.
  • pathName configure ?option? ?value option value ...? β€” query or modify the widget's configuration options ✨. If you don't pass an option, it returns a list describing all the available options for pathName (peep Tk_ConfigureInfo for the tea on how that list is formatted). If you pass option with no value, the command returns a list describing that one named option (and that list is identical to the matching sublist of what you'd get with no option specified). And if you pass one or more option-value pairs, the command changes the given widget option(s) to the given value(s) β€” and in that case it returns an empty string, no cap. Option can be any value the panedwindow command accepts.
  • pathName forget window ?window ...? β€” removes the pane containing window from the panedwindow. All geometry management options for window get forgotten, like it never happened πŸ’€.
  • pathName identify x y β€” figures out which panedwindow component is underneath the point given by x and y, in window coordinates. If the point is over a sash or a sash handle, you get a two element list with the index of the sash or handle plus a word saying whether it's a sash or a handle β€” something like {0 sash} or {2 handle}. If the point is over literally any other part of the panedwindow, you get an empty list. that's it, that's the vibe.
  • pathName panecget window option β€” queries a management option for window. Option can be any value allowed by the paneconfigure subcommand.
  • pathName paneconfigure window ?option? ?value option value ...? β€” query or modify the management options for window. If you don't give an option, it returns a list describing all the available options for pathName (again, Tk_ConfigureInfo has the format deets). If you give option with no value, you get a list describing that one named option (identical to the corresponding sublist from the no-option version). And if you give one or more option-value pairs, it modifies the given widget option(s) to the given value(s) and returns an empty string. These are the options it supports πŸ‘‘:
    • -after window β€” insert the window after the window specified. window should be the name of a window that's already managed by pathName.
    • -before window β€” insert the window before the window specified. window should be the name of a window that's already managed by pathName.
    • -height size β€” specify a height for the window. This height is the outer dimension of the window, including its border, if it has one. If size is an empty string, or if -height isn't specified at all, then the height requested internally by the window gets used initially β€” and that height may later get adjusted by sashes moving around in the panedwindow. Size can be any value accepted by Tk_GetPixels.
    • -hide boolean β€” controls whether a pane is visible or not πŸ™ˆ. When the boolean is true (per Tcl_GetBoolean) the pane won't be visible, but it still stays in the list of panes. sneaky but valid.
    • -minsize n β€” says the size of the window can't go below n. Heads up: this constraint only affects the size of the widget in the paned dimension β€” that's the x dimension for horizontal panedwindows, and the y dimension for vertical panedwindows. Can be any value accepted by Tk_GetPixels.
    • -padx n β€” a non-negative value saying how much extra space to leave on each side of the window in the X-direction. The value can take any form accepted by Tk_GetPixels.
    • -pady n β€” a non-negative value saying how much extra space to leave on each side of the window in the Y-direction. The value can take any form accepted by Tk_GetPixels.
    • -sticky style β€” if a window's pane is bigger than the window's requested dimensions, this option positions (or stretches) the window inside its pane. Style is a string containing zero or more of the characters n, s, e or w. The string can optionally contain spaces or commas, but those get ignored, so do not stress. 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 gets stretched to fill the entire height (or width) of its cavity. iconic behaviour honestly.
    • -stretch when β€” controls how extra space gets handed out to each of the panes. When is one of always, first, last, middle, and never. The panedwindow calculates the required size of all its panes, and any remaining (or deficit) space gets distributed to the panes marked for stretching. That space is distributed based on each pane's current ratio of the whole. The when values mean:
      • 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 is the outer dimension of the window, including its border, if any. If size is an empty string, or if -width isn't specified, then the width requested internally by the window gets used initially β€” and it may later get adjusted by sashes moving around in the panedwindow. Size can be any value accepted by Tk_GetPixels.
  • pathName panes β€” returns an ordered list of the widgets managed by pathName. πŸ“‹
  • pathName proxy ?args? β€” used to query and change the position of the sash proxy, which is the whole rubberband-style pane resizing situation. It can take any of these forms:
    • pathName proxy coord β€” return a list with 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? β€” used to query and change the position of sashes in the panedwindow. It can take any of these 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 β€” computes the difference between the given coordinates and the coordinates given to the last sash mark command for that sash, then moves that sash by 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 together 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 gets resized by grabbing the sash (or the sash handle, if there is one) and dragging with the mouse. This happens via mouse motion bindings on the widget. When a sash moves, the sizes of the panes on each side of that sash β€” and therefore the widgets inside those panes β€” get adjusted. slay.

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

Real talk, bestie: 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 those have become mapped. So it may be advisable β€” especially when you're creating layouts interactively β€” to not add a pane to the panedwindow widget until after that pane's geometry requests have been finalized. That means all components of the pane inserted, all options affecting geometry set to their proper values, etc. Get your life together first, then add the pane. πŸ’…

🌸 SEE ALSO 🌸

ttk::panedwindow(3tk)


⭐ KEYWORDS ⭐

panedwindow, widget, geometry management


And that's the whole page, babe 🫢 this one's from Tk 8.4 and it lives in the panedwindow(3tk) manpage β€” go forth and pane responsibly, you absolute icon πŸ’–βœ¨

πŸ“¦ where this page comes from