Jan-02-2021, 03:41 PM
Jan-02-2021, 06:57 PM
What GUI? Tk? Qt? How are you making the scrollbar? What is the scrollbar supposed to do? Probably best if you make a small example that demonstrates your problem and post the code.
Jan-02-2021, 08:26 PM
from tkinter import Tk, Listbox, Scrollbar root_window = Tk() list_1 = Listbox(root_window, height = 5) list_1.grid(row = 0, column = 0) vsb = Scrollbar(root_window, orient = 'vertical', command = list_1.yview) vsb.grid(row = 0, column = 1) list_1.configure(yscrollcommand = vsb.set) list_1.insert('end', 'item-1') list_1.insert('end', 'item-2') list_1.insert('end', 'item-3') list_1.insert('end', 'item-4') list_1.insert('end', 'item-5') list_1.insert('end', 'item-6') list_1.insert('end', 'item-7') list_1.insert('end', 'item-8') list_1.insert('end', 'item-9') list_1.insert('end', 'item-10') root_window.mainloop()
![[Image: 2.jpg]](https://i.ibb.co/MGZjj6W/2.jpg)
This' my want:
![[Image: 1.jpg]](https://i.ibb.co/R7Kz531/1.jpg)
Thanks.
Jan-02-2021, 10:50 PM
from tkinter import Tk, Listbox, Scrollbar root_window = Tk() list_1 = Listbox(root_window, height = 5) list_1.grid(row = 0, column = 0) vsb = Scrollbar(root_window, orient = 'vertical', command = list_1.yview) vsb.grid(row = 0, column = 1, sticky='NSW') list_1.configure(yscrollcommand = vsb.set) list_1.insert('end', 'item-1') list_1.insert('end', 'item-2') list_1.insert('end', 'item-3') list_1.insert('end', 'item-4') list_1.insert('end', 'item-5') list_1.insert('end', 'item-6') list_1.insert('end', 'item-7') list_1.insert('end', 'item-8') list_1.insert('end', 'item-9') list_1.insert('end', 'item-10') root_window.mainloop()
Jan-02-2021, 11:11 PM
I usually use pack- fill=X but for grid try:
vsb.grid(row = 0, column = 1,columnspan=2, sticky='n' + 's')
Jan-03-2021, 06:03 PM
Got it, use 'sticky' stretch the 'scrollbar'.


Jan-03-2021, 06:16 PM
You should read up on the layout managerz place, pack and grid