import tkinter as tk from tkinter import ttk root = tk.Tk() st = ttk.Style() st.layout("Vertical.TScrollbar", [('Vertical.Scrollbar.trough', {'sticky': 'ns', 'children': [('Vertical.Scrollbar.thumb', {'expand': '1', 'sticky': 'nswe'} )] } )] ) bw = st.lookup("Vertical.TScrollbar.trough", "borderwidth") \ + st.lookup("Vertical.TScrollbar.thumb", "borderwidth") c = tk.Canvas(root, width=400, height=300, scrollregion=(0, 0, 400, 500)) c.pack(side="left") c.create_rectangle(0, 200, 400, 300, fill="red") s = ttk.Scrollbar(root, command=c.yview) s.pack(side="right", fill="y") c.config(yscrollcommand=s.set) root.update() h = s.winfo_height() d = h - h / s.fraction(0, h - bw) print(round(d)) print(d) root.mainloop()