Python Forum
[Tkinter] Database with gui
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Database with gui
#2
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.
Reply


Messages In This Thread
Database with gui - by mark9 - Mar-19-2021, 08:26 PM
RE: Database with gui - by deanhystad - Mar-20-2021, 02:23 PM
RE: Database with gui - by mark9 - Mar-20-2021, 04:32 PM
RE: Database with gui - by deanhystad - Mar-20-2021, 05:23 PM
RE: Database with gui - by mark9 - Mar-21-2021, 09:33 AM
RE: Database with gui - by deanhystad - Mar-22-2021, 02:55 AM
RE: Database with gui - by mark9 - Mar-22-2021, 12:03 PM
RE: Database with gui - by deanhystad - Mar-21-2021, 09:30 PM
RE: Database with gui - by deanhystad - Mar-22-2021, 02:44 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020