Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

positioning windows

Status
Not open for further replies.

japskar

Programmer
Feb 13, 2002
27
is there an easy way of positioning windows on the centre of the screen? it has to be size-independent since I don't know the windows' size in advance.
-Jasper
 
#script to center main window
update
set sw [lindex [wm maxsize .] 0]
set sh [lindex [wm maxsize .] 1]
set ww [winfo width .]
set wh [winfo height .]
set newx [expr ($sw-$ww)/2]
set newy [expr ($sh-$wh)/2]
wm geometry . "+$newx+$newy" Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top