Skip to content

Commit

Permalink
PLaying with center #177
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Jarvis committed Jan 27, 2018
1 parent fe10344 commit c6f3e43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions appJar/appjar.py
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions examples/issues/issue266.py
Expand Up @@ -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")
Expand All @@ -28,7 +27,7 @@ def makeTable():
data += ");"
runSql(data)
app.changeOptionBox("table", getTables())
app.removeSubWindow("Make Table")
changeDb()

def runSql(sql):
print(sql)
Expand Down Expand Up @@ -106,12 +105,14 @@ 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()
app.optionBox("table", tables, change=changeDb)
app.config(sticky="NEWS")
app.setStretch("both")
app.addDbGrid("projects", DB_NAME, "projects")
app.config(sticky="")
app.button("NEW TABLE", showMakeTable)

0 comments on commit c6f3e43

Please sign in to comment.