Akascape / CTkListbox

A simple listbox for customtkinter (extenstion/add-on)
MIT License
130 stars 14 forks source link

curselection issue #44

Closed bndkti closed 4 months ago

bndkti commented 5 months ago

Great Listbox! I've got a issue with the curselection in my project. It is very simple, i want to select an item of the listbox and the selected item have to show in an entry digit. But it doesen't work. How is the code, to get the value from the index?

My try: index = list.curselection()[0] value = list.get(index)

P3rdigas commented 5 months ago

The function curselection() already return the index of the selected option.

An example is:

index = listbox.curselection()
value = listbox.get(index)

Keep in mind, that this example works when the user cannot select multiple options, however if you want multiple selection curselection() will return the indexes of the selected options.