From 44e0e2d6e3b53c0b96bc41aea5792186f0a71a1c Mon Sep 17 00:00:00 2001 From: Joe R Date: Mon, 7 Mar 2022 18:10:10 -0500 Subject: [PATCH] Take into account title bar when determining tree window locations. --- pysollib/tile/selectcardset.py | 7 ++++++- pysollib/tile/selectgame.py | 7 ++++++- pysollib/tile/selecttile.py | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/pysollib/tile/selectcardset.py b/pysollib/tile/selectcardset.py index 31c8d36e..6b723001 100644 --- a/pysollib/tile/selectcardset.py +++ b/pysollib/tile/selectcardset.py @@ -226,13 +226,18 @@ class SelectCardsetDialogWithPreview(MfxDialog): if self.TreeDataHolder_Class.data is None: self.TreeDataHolder_Class.data = self.TreeData_Class(manager, key) # + + # Title bar height - based on parent window as this window + # isn't visible yet. Less accurate, but looks cleaner. + th = int(parent.winfo_rooty() - parent.winfo_y()) + sw = self.top.winfo_screenwidth() sh = self.top.winfo_screenheight() h = int(sh * .8) w = int(sw * .8) w1 = int(min(275, sw / 2.5)) - geometry = ("%dx%d+%d+%d" % (w, h, (sw - w) / 2, (sh - h) / 2)) + geometry = ("%dx%d+%d+%d" % (w, h, (sw - w) / 2, ((sh - h) / 2) - th)) self.top.wm_minsize(400, 200) paned_window = ttk.PanedWindow(top_frame, orient='horizontal') diff --git a/pysollib/tile/selectgame.py b/pysollib/tile/selectgame.py index a3f6aad3..6433d37f 100644 --- a/pysollib/tile/selectgame.py +++ b/pysollib/tile/selectgame.py @@ -356,13 +356,18 @@ class SelectGameDialogWithPreview(SelectGameDialog): if self.TreeDataHolder_Class.data is None: self.TreeDataHolder_Class.data = self.TreeData_Class(app) # + + # Title bar height - based on parent window as this window + # isn't visible yet. Less accurate, but looks cleaner. + th = int(parent.winfo_rooty() - parent.winfo_y()) + sw = self.top.winfo_screenwidth() sh = self.top.winfo_screenheight() h = int(sh * .8) w = int(sw * .8) w1 = int(min(275, sw / 2.5)) - geometry = ("%dx%d+%d+%d" % (w, h, (sw - w) / 2, (sh - h) / 2)) + geometry = ("%dx%d+%d+%d" % (w, h, (sw - w) / 2, ((sh - h) / 2) - th)) self.top.wm_minsize(400, 200) # print sw, w1, w2 diff --git a/pysollib/tile/selecttile.py b/pysollib/tile/selecttile.py index 9597fb16..d2646633 100644 --- a/pysollib/tile/selecttile.py +++ b/pysollib/tile/selecttile.py @@ -128,13 +128,18 @@ class SelectTileDialogWithPreview(MfxDialog): if self.TreeDataHolder_Class.data is None: self.TreeDataHolder_Class.data = self.TreeData_Class(manager, key) # + + # Title bar height - based on parent window as this window + # isn't visible yet. Less accurate, but looks cleaner. + th = int(parent.winfo_rooty() - parent.winfo_y()) + sw = self.top.winfo_screenwidth() sh = self.top.winfo_screenheight() h = int(sh * .8) w = int(sw * .8) w1 = int(min(275, sw / 2.5)) - geometry = ("%dx%d+%d+%d" % (w, h, (sw - w) / 2, (sh - h) / 2)) + geometry = ("%dx%d+%d+%d" % (w, h, (sw - w) / 2, ((sh - h) / 2) - th)) self.top.wm_minsize(400, 200) padx, pady = 4, 4