tkinter doesn't support scrolling widgets inside a frame. The only vertically scrollable widgets are the Text
, Canvas
, Listbox
, and ttk.Treeview
widgets.
Since you are using place
for the buttons, you can instead add the buttons to a canvas since you can position widgets at exact coordinates. I've shown an example at the end of this pot.
If you prefer to use grid
or pack
to arrange, see Adding a scrollbar to a group of widgets in Tkinter which shows how to put your buttons in a frame, put the frame in a canvas, and then scroll the frame as part of the canvas.
Here's how to do it if you want to place the widgets at specific coordinates by adding them directly to a canvas.
from tkinter import *
root = Tk()
root.geometry("555x350")
canvas = Canvas(root)
vsb = Scrollbar(root, orient="vertical", command=canvas.yview)
hsb = Scrollbar(root, orient="horizontal", command=canvas.xview)
root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)
canvas.configure(xscrollcommand=hsb.set, yscrollcommand=vsb.set)
canvas.grid(row=0, column=0, sticky="nsew")
vsb.grid(row=0, column=1, sticky="ns")
hsb.grid(row=1, column=0, sticky="ew")
b1 = Button(canvas, text="Sample button 1")
b2 = Button(canvas, text="Sample button 1")
b3 = Button(canvas, text="Sample button 1")
b4 = Button(canvas, text="Sample button 1")
b5 = Button(canvas, text="Sample button 1")
b6 = Button(canvas, text="Sample button 1")
b7 = Button(canvas, text="Sample button 1")
b8 = Button(canvas, text="Sample button 1")
canvas.create_window(0, 0, anchor="nw", window=b1)
canvas.create_window(0, 30, anchor="nw", window=b2)
canvas.create_window(0, 90, anchor="nw", window=b3)
canvas.create_window(0, 160, anchor="nw", window=b4)
canvas.create_window(0, 334, anchor="nw", window=b5)
canvas.create_window(120, 0, anchor="nw", window=b6)
canvas.create_window(230, 0, anchor="nw", window=b7)
canvas.create_window(472, 0, anchor="nw", window=b8)
canvas.bind("<Configure>", lambda event: canvas.configure(scrollregion=canvas.bbox("all")))
root.mainloop()