diff --git a/appJar/appjar.py b/appJar/appjar.py index 4036022..9788296 100644 --- a/appJar/appjar.py +++ b/appJar/appjar.py @@ -265,10 +265,8 @@ def GET_DIMS(container): dims["b_width"] = dims["r_width"] dims["b_height"] = dims["r_height"] else: - dims["b_height"] = min(dims["r_height"], dims["w_height"]) - dims["b_width"] = min(dims["r_width"], dims["w_width"]) - dims["h_height"] = max(dims["r_height"], dims["w_height"]) - dims["h_width"] = max(dims["r_width"], dims["w_width"]) + dims["b_height"] = max(dims["r_height"], dims["w_height"]) + dims["b_width"] = max(dims["r_width"], dims["w_width"]) return dims @@ -298,8 +296,10 @@ def CENTER(win, up=0): win.update_idletasks() - outer_frame_width = win.winfo_rootx() - win.winfo_x() - titlebar_height = win.winfo_rooty() - win.winfo_y() + # GUI's corner - widget's corner + # widgret's corner can be 0 on windows when size not set by user + outer_frame_width = 0 if win.winfo_x() == 0 else win.winfo_rootx() - win.winfo_x() + titlebar_height = 0 if win.winfo_rooty() == 0 else win.winfo_rooty() - win.winfo_y() dims = gui.GET_DIMS(win) actual_width = dims["b_width"] + (outer_frame_width * 2) diff --git a/examples/issues/issue266.py b/examples/issues/issue266.py index 4c11df9..82285c1 100644 --- a/examples/issues/issue266.py +++ b/examples/issues/issue266.py @@ -5,7 +5,6 @@ types = ["NULL", "INTEGER", "REAL", "TEXT", "BLOB"] def makeTable(): -# app.hideSubWindow("Make Table") fields = app.getAllEntries() types = app.getAllOptionBoxes() prim = app.radio("PRIMARY") @@ -28,7 +27,7 @@ def makeTable(): data += ");" runSql(data) app.changeOptionBox("table", getTables()) - app.removeSubWindow("Make Table") + changeDb() def runSql(sql): print(sql) @@ -106,7 +105,8 @@ def setup(): c.execute(task, ('Analyze the requirements of the app', 1, 1, project_id, '2015-01-01', '2015-01-02')) c.execute(task, ('Confirm with user about the top requirements', 1, 1, project_id, '2015-01-03', '2015-01-05')) -with gui("DB Demo", stretch="column", bg="DarkOrange") as app: +with gui("DB Demo", "800x600", stretch="column", bg="DarkOrange") as app: + app.setLogLevel("debug") app.label("title", "DB tester", bg="orange", font={'size':20}) app.config(sticky="NE") tables = getTables() @@ -114,4 +114,5 @@ def setup(): app.config(sticky="NEWS") app.setStretch("both") app.addDbGrid("projects", DB_NAME, "projects") + app.config(sticky="") app.button("NEW TABLE", showMakeTable)