I am developing an application that displays a large database of items.
There is also a search bar allowing the user to search that database rather than scrolling through each item to find the one they need. When the search returns True (a match was made) the information needed shows up in a textbox and more options in another listbox (not scrolled now), but the ScrolledListBox does not auto-scroll to the selected item even if I am using selection_set() or list_box.active().
I got it! I had to use the list_box.yview_scroll() command! That takes 2 arguments:
1) The integer/index of where to go
2) Line by line or by pages(UNITS or PAGES)
But I do find the .see method to be more efficient!
Tkinter doesn’t have a ScrolledListBox class. Can you be more specific about which ScrolledListBox implementation you’re using?
That being said, the scrollable widgets in Tkinter typically have a
seemethod that will scroll enough to make sure the passed-in index is visible.In the comment to this answer you say you are using pmw.ScrolledListBox. According to the documentation for the ScrolledListBox widget:
Therefore, you can call any method on that widget that you can call on a Listbox widget. As I mentioned earlier, the Listbox class has a
seemethod, so you should be able to do something like:In the above example
indexis the row in the listbox you want to see.