The command you need is
wm geometry. Check the
wm reference page for complete information (for example,
But basically, specifying only a window name returns the current size and position of the window in standard X style:
[tt]%
wm geometry .
200x200+20+173[/tt]
In other words, my toplevel "." is 200x200 pixels in size (
widthxheight), and located at X=20, Y=173 (in pixels) on my display (
+x+y). A quick way to split this information out into separate variables is the Tcl
split command:
[tt]%
[ignore]foreach {width height x y} [split [wm geometry .] "x+"] {break}[/ignore]
%
puts "Width: $width\nHeight: $height\nX: $x\nY: $y"
Width: 200
Height: 200
X: 20
Y: 173[/tt]
Providing a geometry specification to the
wm geometry command requests the window manager to size and position the window accordingly. For example:
[tt]%
toplevel .dialog
.dialog
%
wm geometry .dialog 150x100+240+173[/tt] - Ken Jones, President, ken@avia-training.com
Avia Training and Consulting,
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax