I would like to use a single (vertical) scrollbar to scroll through multiple listboxes at the same time (synchronised) in Tkinter.
The problem is that all the solutions out there on Stack Overflow seem to use classes to append a single scrollbar to multiple listboxes. I would like to do the same without using a class if that's possible as I haven't got any experience with classes.
Here's a simplified version of my code:
from tkinter import *
import tkinter as tk
root = Tk()
##This code will only scroll through 1 listbox.
listbox1 = Listbox(root)
listbox1.grid(row=1, column=2)
listbox2 = Listbox(root)
listbox2.grid(row=1, column=3)
scrollbary = Scrollbar(root, command=listbox1.yview, orient=VERTICAL)
scrollbary.grid(row=1, column=1, sticky="ns")
for i in range(100):
listbox1.insert("end","item %s" % i)
listbox2.insert("end","item %s" % i)