22
loading...
This website collects cookies to deliver better user experience
SELECT
statements are familiar - but do ask if you'd like those explained.# Parent records Treeview, scrollbars
tk_trvw_prnt = im_tkntr_ttk.Treeview( tk_frame_prnt_data)
tk_trvw_prnt.place( relheight=1.0, relwidth=1.0)
# adding scrollbars
tk_trvw_prnt_treescrolly = im_tkntr.Scrollbar(tk_frame_prnt_data, orient="vertical", command=tk_trvw_prnt.yview)
tk_trvw_prnt_treescrollx = im_tkntr.Scrollbar(tk_frame_prnt_data, orient="horizontal", command=tk_trvw_prnt.xview)
tk_trvw_prnt.configure( xscrollcommand=tk_trvw_prnt_treescrollx.set, yscrollcommand=tk_trvw_prnt_treescrolly.set)
tk_trvw_prnt_treescrollx.pack(side="bottom", fill="x")
tk_trvw_prnt_treescrolly.pack(side="right", fill="y")
tk_trvw_prnt.bind("<<TreeviewSelect>>", Cmd_trvw_prnt_on_tree_select)
a_rows
& a_names
for the data and column names.a_didok, a_rows, a_names = SqLite_Filename_GetTable_Rows( ExampleDetail_Database_Filename(), ExampleDetail_Parent_Tablename() )
tk_trvw_prnt["column"] = a_names
tk_trvw_prnt["show"] = "headings"
for column in tk_trvw_prnt["columns"]:
tk_trvw_prnt.heading(column, text=column)
for row in a_rows:
tk_trvw_prnt.insert("", "end", values=row)
for i in tk_trvw_prnt.get_children():
tk_trvw_prnt.delete(i)
def GetCurrentParentKey():
slctn_prnt = tk_trvw_prnt.selection()
curItem = tk_trvw_prnt.focus()
curParts = tk_trvw_prnt.item( curItem)
curRow = curParts[ "values"]
clms_idx_pky = tk_trvw_prnt["column"].index(ExampleDetail_Parent_LinkColumnName())
pkyval = curRow[ clms_idx_pky ]
return pkyval