Closed codedreamin closed 1 year ago
@codedreamin Ok I will add this function.
For now use this:
listbox.buttons[index].configure(fg_color=listbox.select_color, hover=False)
@Akascape
Would highlighted listbox items still be found with a curselection call? My original comment may not have been clear, what I'm trying to do is select listbox items without calling the command assigned to the listbox
In that case I wonder if it might be easier to just add an option to the select method for choosing to call the command or not.
Thank you!
@codedreamin Not with that method. But instead you can use this trick:
listbox = CTkListbox(root)
...
listbox.select(1)
listbox.configure(command=func) # add the command after selecting
@Akascape
Yes I think that could work if the selections only happened once, unfortunately my list is dynamic. It's a list of curves that could be added to a graph. I have another list of 'saved graphs' and so essentially when a saved graph is selected it goes and selects the curves that were saved under that graph.
@codedreamin Then you can set the command to none before selecting, then again set the function after selection.
listbox.configure(command=None)
listbox.select(1)
listbox.configure(command=func)
@Akascape
Ahh that could work, I'll give it a try. Thanks!
Edit: Works great!
Is there a method to highlight listbox items without using select?
Something like CTkListbox.highlight(index)
To clarify I'm basically looking for a method to highlight listbox items without calling any command that's assigned to the listbox.