Pod - 1.2

a new kind of toplevel window.

Table Of Contents


pod - a new kind of toplevel window.


package require Pod

Pod pathName ?options?

Pod adapt pathname ?options?


A Pod is an extended toplevel widget with a special look&feel.

The Pod command creates a new toplevel widget (given by the pathName argument). Additional options, described below, may be specified on the command line or in the option database to configure aspects of the Pod such as its background color.

Other than creating new Pods, the Pod command can also transform existing toplevel widgets.


All toplevel options are supported.

Options can be managed with the classic cget and configure commands.

Be careful that some standard options could be meaningless (or worst, dangerous) in a Pod context. Use them with care ..


-resizable boolean
This option controls whether or not the user may interactively resize a Pod widget. If resizing is enabled, a small grip icon is displayed near the bottom-right corner of the widget. Default value is true
-transparentcolor color (for MS-Windows only)
In order to properly display rounded corners, Pod makes use of the "wm attributes $win -transparent $color" command. This means that if you draw something within the Pod with this color, it will look like as holes.

If you really need to use this color for your app, you should choose another unused color, and change this option. Color may have any of the forms accepted by Tk_GetColor. This option defaults to #ff00ff
-title string
String will be displayed centered on the top of the widget.
-titlecolor color
The color used for the title. If color is the null string, then a color constrasting to the -background color is automatically set.
-titlefont font
The font used for the title.
-titleseparator thickness
Set the thickness of a horizontal line placed under the title. Default is 0.
-icontooltip string
When the widget is iconified, string is displayed as a tooltip.
-controlbarstyle style
Currently style must be none, pod, aqua, win. Each style provides a different arrangement for a group of predefined mini-buttons (minimize, maximize, close). Note that the maximize minibutton is always disabled.
-controlbaralign where
Move the group of mini-buttons at left or right. Note that -controlbarstyle may change the value of this option.


All command working with a toplevel-window can be used.

    set w [Pod .mypod -background yellow]  ; # create a new Pod
    $w configure ....                      ; # set some options ...
    $w cget ...                            ; # get current options ...
    wm geometry $w ...                     ; # move/resize the widget
    destroy $win                           ; # destroy it !

Be careful that some wm subcommands are meaningless or worst dangerous. In particular never use the "wm iconify .." or "wm deiconify .." commands; use the specific pod-commands listed below.


$w iconify
$w deiconify
Use these commands for switching from a normal-Pod widget to an iconified-Pod. Note that if you enable the controlbar's mini-buttons (see -cotrolbarstyle option), you can iconify/deiconify interactively.

Note that iconified-Pods are very different from standard iconified-windows ; they appear as small-pod (a nut). User can move them (drag) or restore their original appearance by pressing the restore minibutton ..

$pod controlbar ...
Reserved for internal use ...


Pod-windows are created with Pod class bindings giving them their default behavior:

Click and drag over the Pod borders or any internal zone.

Starting from Pod 1.1, you can start dragging the whole Pod by simply pressing Button-1 over ANY point inside the Pod, provided that the cursor is over a inert internal widget, i.e. a widget NOT having its own binding with Button-1 (e.g. scrollbars, button, ....).

Note that when a sub-widgets is disabled, it becomes inert.

In case of trobles, if you want a inert widget ($w) behave like an active widget, add a fake binding:
       bind $w <Button-1> {;}
If you want all (inert) widgets of a given class behave like an active widget, add a fake class-binding:
       bind _ClassName_ <Button-1> {;}    ; # e.g.  ClassName = Label
Click and drag on the grip placed at the bottom-right corner (if not disabled, see -resizable option).


Default values for Pod's options (and inherithed toplevel options) may be redefined via the standard Tk-options-database mechanism.

Here are the default value:

    option add *Pod.background       #eaeaea
    option add *Pod.controlbarstyle  none
    option add *Pod.controlbaralign  right
    option add *Pod.icontooltip      mini-pod
    option add *Pod.titleseparator   0
    option add *Pod.titlefont        TkDefaultFont
    option add *Pod.titlecolor       ""

If you want all the new Pods have a green background, issue the following command after the Pod package has been loaded:

    option add *Pod.background       green


Create a new Pod named .myPod

   package require Pod
   Pod .myPod -bg blue 

or you can adapt an existing toplevel window

     # .. create a toplevel ".myWin", add some internal widgets,
     #    customize it ....
    Pod adapt .myWin
     # change the color and make it non-resizable
    .myWin configure -color orange -resizable false


In order to display its typical rounded borders, Pod creates some internal widgets. For each Pod $win, some labels named $win.pod_* are created (and automatically destroyed when the Pod is destroyed). You should not modify these internal components.

Also a lot of images are automatically created/destroyed. Although they are visible to programmers, they should not be directly altered.