diff options
author | Guido van Rossum <guido@python.org> | 1997-12-28 03:42:50 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-12-28 03:42:50 (GMT) |
commit | adfacf4e2e8562a67b9611b50c252d6cf239da7a (patch) | |
tree | 9da2275426a966176921039d8440ce47e2a68f8c /Lib | |
parent | 0ee358529e7bbce8a2efdba2dc96a027daaf60f2 (diff) | |
download | cpython-adfacf4e2e8562a67b9611b50c252d6cf239da7a.zip cpython-adfacf4e2e8562a67b9611b50c252d6cf239da7a.tar.gz cpython-adfacf4e2e8562a67b9611b50c252d6cf239da7a.tar.bz2 |
Do a better job of keeping the dialog visible when the master window
is near or beyond the edge of the screen. Patch by Skip Montanaro.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/lib-tk/SimpleDialog.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/lib-tk/SimpleDialog.py b/Lib/lib-tk/SimpleDialog.py index 7354779..950df2f 100644 --- a/Lib/lib-tk/SimpleDialog.py +++ b/Lib/lib-tk/SimpleDialog.py @@ -52,6 +52,14 @@ class SimpleDialog: w_height = widget.winfo_reqheight() x = m_x + (m_width - w_width) * relx y = m_y + (m_height - w_height) * rely + if x+w_width > master.winfo_screenwidth(): + x = master.winfo_screenwidth() - w_width + elif x < 0: + x = 0 + if y+w_height > master.winfo_screenheight(): + y = master.winfo_screenheight() - w_height + elif y < 0: + y = 0 widget.geometry("+%d+%d" % (x, y)) widget.deiconify() # Become visible at the desired location |