[Tkinter-discuss] What determines the initial position of Tkinter's root and Toplevel() windows?

Michael Lange klappnase at web.de
Fri Dec 10 19:48:32 CET 2010


Thus spoketh python at bdurham.com 
unto us on Fri, 10 Dec 2010 11:12:37 -0500:

> What determines the initial position of Tkinter's root and
> Toplevel() windows?
> 
> Under Windows (running Python 2.7), my root window appears to
> show up in random positions (usually clustered around the upper
> left of my display).
> 
> The position of my first Toplevel() window appears to be random
> as well. Subsequent Toplevel() windows appear offset from the
> position of the first Toplevel() window by a consistent(?) amount
> of space. I think the pattern for subsequent Toplevel() window
> positions might be described as a "tiled" effect?
> 
> Are these Tkinter specific behaviors or OS specific behaviors?

If no position is explicitely defined, the window manager will decide
where to display a new window.
> 
> What approach do you take with your window placement:
> 
> - accept the default window position as given by Tkinter
> - proactively specify a window position
> - center your windows on the desktop
> - remember and restore window positions (and sizes?) across
> sessions
> - other

Personally I prefer the first (and in some cases the last) option.
Forcing my app to appear in the upper left corner or center it on the
desktop imho does not make much sense, the users will resize and
reposition them as they want anyway. If any explicit geometry
specification, then I'd tend to restore the last size and position of the
app window, because there is a chance that it comes close to what they
actually want.

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

No problem is insoluble.
		-- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4


More information about the Tkinter-discuss mailing list