Home>

Is it possible in the Tkinter Scrollbar for the treeview table to make the treeview inactive or remove the slider, but not remove it, until it turned out only to completely hide the Scrollbar

scrollbar= ttk.Scrollbar (frame, orient= "vertical", command= tree.yview)
tree.configure (yscrollcommand= scrollbar.set)
i= 0
for item in rows:
    # Output of table rows
    tree.insert (parent= '', index= 'end', iid= 0, text= '', values ​​= (item [0], item [1]))
    i += 1
# if lines are less than 10
if i <
 ten:
    # remove the scroll
    scrollbar.pack_forget ()
else:
    # otherwise we display
    scrollbar.pack (side= RIGHT, fill= Y)
tree.pack (side= LEFT)

But I want not to hide it, but to make the Scrollbar inactive, remove the slider if the table is empty

so it defaults to inactive until a height overflow occurs

splash582021-11-18 05:51:09

The treeview table widget is overflowed by default and the scrolling is active when the number of records in the table decreases; the scroll slider is stretched to the full height, but you need the slider to hide, and the scrollbar itself remains in place

Vitaly2021-11-18 05:51:09