How do I get the index of an item in tkinter.Listbox? How do I get the index of an item in tkinter.Listbox? python-3.x python-3.x

How do I get the index of an item in tkinter.Listbox?


The index method of the listbox isn't the same as the index method of a python list. For the listbox, it translates something like "end" or "@x,y" into a numerical index.

To search, get the values as a python list, and then use the index method of the list:

index = y.get(0, "end").index("value1")