here is a code to define a scrollbar in a listbox with Tkinter :
import tkinter as tk
root = tk.Tk()
scrollbar = tk.Scrollbar(root)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
listbox = tk.Listbox(root)
listbox.pack()
for i in range(50):
listbox.insert(tk.END, i)
listbox.config(yscrollcommand=scrollbar.set)
scrollbar.config(command=s.set)
root.mainloop()
I want to adapt this code to have a scrollbar with checkbuttons, I know I can't fill a Listbox with Checkbuttons because listbox can only contain text
scrollbar = tk.Scrollbar(self)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
categories = ["aaa","bbb","ccc"]
for i in categories:
var[i] = tk.IntVar()
chk = tk.Checkbutton(self, text=i, variable=var[i], width=20)
#chk.select()
chk.pack()
scrollbar.config(command=s.set)
How can I make my Checkbuttons "scrollable" ?