Akascape / CTkListbox

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

Is there an equivalent option to .see(index)? #66

Open ohshitgorillas opened 5 months ago

ohshitgorillas commented 5 months ago

I have a very long listbox of 60+ items that runs off the screen. Basically, this is data reduction software, so the user is viewing an analysis, clicks next, views the next analysis, and the listbox will update to highlight the currently viewed analysis.

This is all well and good until clicking "Next" starts to highlight analyses which runs off the screen. The listbox keeps highlighting analyses lower and lower, but the user has to manually scroll down to see where they are in the list.

With a tkinter listbox, this was as easy as implementing a line listbox.see(index), however, CTkListbox doesn't seem to have a .see(index) option.

If there's another way to keep the position of the scrollbar updated so that the current sample is highlighted, I'd love to know about it. Otherwise, I'd like to request an equivalent option to .see(index) that will always keep the highlighted index visible.

Akascape commented 5 months ago

@ohshitgorillas I will add the .see option in next update, for now you can use this method to change the scrollbar to bottom

listbox._parent_canvas.yview_moveto(1.0)

or

listbox._scrollbar._command("moveto", 1.0)