Apr-25-2020, 10:00 PM
The problem is caused by you making a new window each time the Columns button is pressed. Though wasteful and potentially confusing, this would work if you also reset the column_values array.
I added some comments below to point out the problem spots.
I added some comments below to point out the problem spots.
def get_columns(field_names): new_window = Toplevel(mw) new_window.wm_title("Select Columns") new_window.geometry('900x500+250+150') frame3 = Frame(new_window) framebot = Frame(new_window) frame3.pack(side=TOP,fill=X) framebot.pack(side=BOTTOM,fill=X) for i in range(0,max_columns): column_values.append([]) # 2nd time around column_values is not empty j = 0 # 2nd time around column_values[0] holds two combo boxes, one which doesn't exist # anymore because you deleted it. column_values[i].append(ttk.Combobox(frame3,values=field_names)) # column_values[0][0] is the deleted combo box column_values[i][j].grid(row=i,column= j) exit_button = Button(framebot,text='Exit',font=("Times",16),command=new_window.destroy).pack(side="right")