Version 21 of paned window

Updated 2005-08-15 13:50:00 by escargo

This page describe what a paned window is, and where to find implementations.

A paned window is a widget consisting of two windows with a bar down the middle, where the bar has a handle for resizing the two windows.


Tcl/Tk 8.4 has a panedwindow, and a spinbox as well as a labelframe. The panedwindow was the result of TIP 41 [L1 ] which proposed a built-in PanedWindow.

Ro: I always find that I need some examples to get started with a widget. So here is a simple example that should get you started with the panedwindow from Tk 8.4 (be sure to check out the man page [L2 ] for details)

  package require Tk 8.4
  panedwindow .pw -orient vertical
  label .pw.x1 -text Bapy -fg orange -bg black
  label .pw.x2 -text Mojo -fg white  -bg red
  .pw add .pw.x1 -minsize 200
  .pw add .pw.x2 -minsize 100
  pack .pw -fill both -expand yes

Maximize the window to see how you can alter the sizes of the panes, while respecting the minsize that was chosen by the config option -minsize .

The widgets that you add to the panedwindow MUST be children of the panedwindow, in this case they must be .pw.something .

On windows, mouse-button-1 resizes the panes once you let go of the sash, whereas mouse-button-2 resizes the panes as you move the sash.

If you're looking for a good Tcl/Tk 8.4 implementation, be sure to check out tclkit and starkit.


TR - No, the widgets to add to panedwindow must NOT be children of the pane itself (at least it does not say so in the man page). This version work perectly fine:

 panedwindow .pw -orient vertical
 label .x1 -text Bapy -fg orange -bg black
 label .x2 -text Mojo -fg white  -bg red
 .pw add .x1 -minsize 200
 .pw add .x2 -minsize 100
 pack .pw -fill both -expand yes

BUT, the order of window generation is apparently important. This version, where the pane is created after the labels, does NOT work:

 label .x1 -text Bapy -fg orange -bg black
 label .x2 -text Mojo -fg white  -bg red
 panedwindow .pw -orient vertical
 .pw add .x1 -minsize 200
 .pw add .x2 -minsize 100
 pack .pw -fill both -expand yes

The pane will be visible but the labels won't.


BWidgets [L3 ] has a PanedWindow.

ClassyTk [L4 ] has a Paned widget.

obTcl [L5 ] has a paged window widget.

Jeffrey Hobbs' widget package [L6 ] includes a pure-Tcl geometry-manager-like-thing that serves as a paned window.

Iwidgets [L7 ] (based on itk) includes a panedwindow.

Tix [L8 ] has a paned window.

Do any of these extra paned windows provide features that don't exist in the new Tk 8.4 version?


[Does Perl/Tk have a Pane widget?] VK: Perl/Tk has Tk::Adjuster, which, according to docs, Allow size of packed widgets to be adjusted by user. Strangely, it has Tix mixed in, but PanedWin from Tix was not used, for some reason it has its own... Some kind of implementation details.

[ Category Example | Category GUI | Category Widget ]