Closed ZachVFXX closed 11 months ago
When i use the listbox.delete(index) it leaves me with an error keyerror: and the index I'm trying to delete
listbox.delete(index)
this my code
`def ModifyDataWindow(button_name): window = ctk.CTkToplevel() window.geometry("400x600") window.title("Add data") font = ctk.CTkFont("Arial", 30)
label = ctk.CTkLabel(window, text=f"Modify {button_name} data", font=font) label.pack(padx=20, pady=20) data = read_values_from_json(FILE_PATH, button_name) def show_value(selected_option): print(selected_option) def remove_selection(): selected_indices = listbox.curselection() for index in reversed(selected_indices): listbox.delete(index + 1) listbox = CTkListbox(window, command=show_value, multiple_selection=True) listbox.pack(fill="both", expand=True, padx=10, pady=10) for item in data: listbox.insert(ctk.END, item) removebutton = ctk.CTkButton(window, text="Remove", command=remove_selection) removebutton.pack(padx=20, pady=20)`
Thank you for your help
@ZachVFXX Fixed! update to the latest version.
When i use the
listbox.delete(index)
it leaves me with an error keyerror: and the index I'm trying to deletethis my code
`def ModifyDataWindow(button_name): window = ctk.CTkToplevel() window.geometry("400x600") window.title("Add data") font = ctk.CTkFont("Arial", 30)
Thank you for your help