PanedWindow - Create and manipulate panedwindow widgets

SYNOPSIS

instance = tkinter.PanedWindow(master [,**options])

STANDARD OPTIONS

background or bg
borderwidth or bd
cursor
orient
relief

WIDGET-SPECIFIC OPTIONS

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 Screen Units.

handlesize
Specifies the side length of a sash handle. Handles are always drawn as squares. May be any value accepted by Screen Units.

height
Specifies a desired height for the overall panedwindow widget. May be any value accepted by Screen Units. If an empty string, the widget will be made high enough to allow all contained widgets to have their natural height.

proxybackground
Background color to use when drawing the proxy. If an empty string, the value of the background option will be used.

proxyborderwidth
Specifies the borderwidth of the proxy. May be any value accepted by Screen Units.

proxyrelief
Relief to use when drawing the proxy. May be any of the standard Tkinter relief values. If an empty string, the value of the sashrelief option will be used.

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).

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
Specifies the amount of padding to leave of each side of a sash. May be any value accepted by Screen Units.

sashrelief
Relief to use when drawing a sash. May be any of the standard Tkinter relief values.

sashwidth
Specifies the width of each sash. May be any value accepted by Screen Units.

showhandle
Specifies whether sash handles should be shown. May be any valid Python boolean value.

width
Specifies a desired width for the overall panedwindow widget. May be any value accepted by Screen Units. If an empty string, the widget will be made wide enough to allow all contained widgets to have their natural width.

DESCRIPTION

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

The following methods are possible for Panedwindow widgets:

instance.add(child [,**options])
Add one child window to the panedwindow, in a separate pane. The syntax consists of the child parameter which is name of the child window followed by pairs of keyword arguments that specify how to manage the window. Option may have any of the values accepted by the configure() method.

instance.cget(key)
Returns the current value of the configuration option given as a string by key. Option may have any of the values accepted by the PanedWindow class.

instance.configure()
instance.configure("option")
instance.configure(**options)
Query or modify the configuration options of the widget.
If no option is specified, returns a dictionary describing all of the available options for instance.
If option is specified as a string, then the method returns a dictionary 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 method modifies the given widget option(s) to have the given value(s); in this case the method returns an empty string. Option may have any of the values accepted by the PanedWindow class.

instance.identify(x ,y)
Identify 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 tuple 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 string.

instance.pancget(child ,option)
Query a management option for child. Option may be any value allowed by the paneconfigure() method.

instance.paneconfigure(tagOrId)
instance.paneconfigure(tagOrId [,**options])
Query or modify the management options for tagOrId.
If no option is specified, returns a list describing all of the available options for instance.
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 tagOrId after the window specified. window should be the name of a window already managed by instance.

  • before=window
    Insert the tagOrId before the window specified. window should be the name of a window already managed by instance.

  • height="size"
    Specify a height for the tagOrId. 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 Screen Units.

  • hide=boolean
    Controls the visibility of a pane. When the boolean is True the pane will not be visible, but it will still be maintained in the list of panes.

  • 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 Screen Units.

  • 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 Screen Units.

  • 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 Screen Units.

  • 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 contains 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.

  • width="size"
    Specify a width for the tagOrId. 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 Screen Units.

instance.panes()
Returns an ordered tuple of the widgets managed by instance.

instance.proxy_coord()
Return a tuple containing the x and y coordinates of the most recent proxy location.

instance.proxy_forget()
Remove the proxy from the display.

instance.proxy_place(x ,y)
Place the proxy at the given x and y coordinates.

instance.remove(child)
Remove the pane containing child from the panedwindow. All geometry management options for child will be forgotten.

instance.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.

instance.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.

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 slave windows managed by e.g. pack or grid, the panes managed by a panedwindow do not change width or height to accomodate 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.).

Comments