beetlebug▾
/

wm geometry

Gives or sets the size and the position of a toplevel.

wm geometry WINDOW ?GEOMETRY?

Description

GEOMETRY has the form WIDTHxHEIGHT+X+Y, WIDTHxHEIGHT, or +X+Y, with an optional = at the start. A size from the script stops the automatic size of the window from its layout. A position alone moves the window and keeps its size. With no GEOMETRY, gives the current size and position.

Returns

A geometry string, or an empty string.

Examples

% toplevel .t
> wm geometry .t 200x100+10+20
> update
> list [wm geometry .t] [winfo width .t] [winfo height .t]
200x100+10+20 200 100

% wm geometry .t =120x60
> update
> wm geometry .t +30+40
> update
> wm geometry .t
120x60+30+40

Errors

% wm geometry .t bad
bad geometry specifier "bad"
-errorcode NONE

% wm geometry .t 100x50+10
bad geometry specifier "100x50+10"
-errorcode NONE

Facts

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