beetlebug▾
/

grid anchor

Gives or sets the place of the grid in a container larger than the grid.

grid anchor CONTAINER ?ANCHOR?

Description

When the container is larger than the grid, ANCHOR puts the grid at that side or corner of the container. The anchor has no effect in a direction where a column or a row has a weight. The default is nw. With no ANCHOR, gives the current value.

Returns

The anchor, or an empty string when ANCHOR is given.

Examples

% frame .an -width 100 -height 40
> grid propagate .an 0
> pack .an
> frame .an.a -width 10 -height 10
> grid .an.a
> set a [grid anchor .an]
> grid anchor .an se
> update
> list $a [winfo x .an.a] [winfo y .an.a]
nw 90 30

Errors

% grid anchor .an middle
bad anchor "middle": must be n, ne, e, se, s, sw, w, nw, or center
-errorcode NONE

% grid anchor .an se x
wrong # args: should be "grid anchor window ?anchor?"
-errorcode TCL WRONGARGS

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also