(Mar-20-2021, 02:23 PM)deanhystad Wrote: Searching works fine as far as I can tell. What do you think is wrong?
You get the index error when doing this:
index = list.curselection()[0]And there is nothing selected in the Listbox. Since this is something that can legitimately happen, you need to protect against it.
def get_selected_row(event): global selected_row index = list.curselection() if not index: return selected_row = list.get(index[0]) ...By the way, list is a built-in Python function and should not be used as a variable name.
If I add:
if not index: returnThe error persist.
If I use:
selected_row = list.get(index[0])after that, it shows me this error: 'int' object is not subscriptable
About the search function: what if I want to search on just an entered field or matching the only fields filled? So if user types one, two or more fields, they must all match, even if some fields are not filled. I tried with AND in the query, but the result is not what I expected.