4.4 Using Anchors for Widgets

The anchor option for the packer and the sticky option for the grid geometry manager determine where the widget is placed in its parcel. In the same way several kind of widgets, e. g., message and label widgets, take an anchor option, which determines where the displayed item, e. g., the text or bitmap, is placed within the widget.

Figure 4.11 shows an example for the three label widgets used throughout Section 4.2. The possible values for the anchor options are the same as described in Section 4.2.3.


[L1 L2 L3]={NewLabels}
{Tk.send pack(L1 L2 L3 fill:x)}
{L1 tk(configure anchor:w)}  
{L3 tk(configure anchor:e)}

Figure 4.11: Widgets with anchor options.



Christian Schulte
Version 1.4.0 (20080702)