Feb-23-2022, 02:10 PM
I might have included more code than necessary. The code in question is the last four lines.
What I get in the display is a concatenation of InspectorID and LName. What I get as the value (as determined by a print statement) is the same thing.
I would like to display the name and store the InspectorID into the database table.
How do I sort out the combobox so it performs correctly?
Thanks.
Here is a subset of my code:
What I get in the display is a concatenation of InspectorID and LName. What I get as the value (as determined by a print statement) is the same thing.
I would like to display the name and store the InspectorID into the database table.
How do I sort out the combobox so it performs correctly?
Thanks.
Here is a subset of my code:
lblInspector = Label(maininset, text="Inspector", bg="lightgray", width=lblWidth).place(x=col3, y=rowspacer*4) cmbInspector = ttk.Combobox(maininset) cmbInspector.configure(textvariable=Inspector) cmbInspector.delete(0,END) #gets current InspectorID from Projects table cmbInspector.insert(0,getFld(0,'InspectorID')) cmbInspector.place(x=col4, y= rowspacer*4) Inspector.trace_add("write", flagSave) #dataframe for Inspectors combobox insp_df=pd.read_sql('select InspectorID, LName from Inspectors', conn) #create Inspector combobox cmbInspector.ValueMember = "InspectorID"; cmbInspector.DisplayMember = "LName"; cmbInspector['values']= insp_df.values.tolist();