def make_autoscroll(sbar, first, last):
    """Hide and show scrollbar as needed."""
    first, last = float(first), float(last)
    if first <= 0 and last >= 1:
        sbar.grid_remove()
    else:
        sbar.grid()
    sbar.set(first, last)
Hide and show scrollbar as needed.
recipes/Python/580756_Ordered_Listbox_for_Tkinter/recipe-580756.py