I have a function that opens a top-level window, places a listbox widget, populates it, and then on close should store those selected values to a list, but I am getting an error that I can't seem to find in any google search. Any ideas?
def select_exer():
#Create the new Window
sel_exer_window = tk.Toplevel(main)
sel_exer_window.geometry("+%d+%d" % (x+1150,y+180))
#Descriptive Text
exer_text = tk.Label(sel_exer_window, text="Select your exercises").pack()
exercise_list = tk.Listbox(sel_exer_window, selectmode='multiple')
exercise_list.pack()
def poplist():
lst = exer_options
exercise_list.insert("end",*lst)
poplist()
def on_closing():
#Unlocks the next Button
COUNT_DOWN_BUTTON.config(state="normal")
#Closes the Window
sel_exer_window.destroy()
#lst_var = [exercise_list.get(idx) for idx in exercise_list.curselection()]
lst_var = [exercise_list.get(idx) for idx in exercise_list.curselection()]
print(type(lst_var))
sel_exer_window.protocol("WM_DELETE_WINDOW", on_closing)