tkSimpleDialog.py & tvtwm
mlv at pobox.com
Thu Jun 24 18:42:40 CEST 1999
I think I've found a bug in tkSimpleDialog (Python 1.5.1, apologies
if it's been fixed in 1.5.2).
In the Dialog class, in __init__(), it sets it's geometry by:
self.geometry("+%d+%d" % (parent.winfo_rootx()+50,
Problem is, in tvtwm, if you're not in the first window, the rootx
and rooty are that of the full virtual window (e.g., if you're in
one window over, at X position 250 (relative to the current window),
and your screen is 1000 pixels wide, rootx returns 1250. When the
geometry is set, it then sets it to be 1250 relative to the current
window, which, if your virtual space is only two screens wide, is off
the screen, never to be seen again.
A solution that I believe will work with both tvtwm and fvwm2 (only
two I've checked, but probably others) is to add winfo_vrootx() to
the mix. In fvwm2, vrootx is always 0 (I think), while in tvtwm, it
is (in the above example), -1000. Adding it would give a current
position of 250, which will work for future windows.
I hope those who know much more about window managers than I do will
correct my theories as they see fit. For myself, I'm fixing the problem
locally by adding winfo_vrootx/y to that line. Let me know if there's a
better way that is more portable (or preferably, whatever way will be
used in future versions of python).
More information about the Python-list