[Tkinter-discuss] constraining toplevel windows to be on screen?
Russell E. Owen
rowen at uw.edu
Tue May 4 23:11:36 CEST 2010
I've received a bug report that my application's windows can appear off
screen. This happens when a user has two monitors and saves window
positions, then runs again later with only one monitor. Tkinter is
apparently perfectly happy to display toplevel windows entirely off
screen. At least on Mac OS X.
The solution I've thought of is to get the full screen size using
"root.wm_maxsize" and use that to constrain the geometry when restoring
the window positions.
However, it is messy code because tk geometry strings are complex: they
may be missing the extent, or the extent may be positive or negative.
So I was wondering if somebody had a simpler solution or had already
written code they would be willing to share (and, preferably, allow me
to redistribute in the RO package).
It would suffice to show part of each window on screen, though it would
be better to show the whole thing.
Regards,
-- Russell
More information about the Tkinter-discuss
mailing list