Python Forum
[Tkinter] How to place scroll bar correctly - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] How to place scroll bar correctly (/thread-26917.html)



How to place scroll bar correctly - scratchmyhead - May-18-2020

I have a listbox that is inside of a frame and when I put a scrollbar with the listbox, I want it to be to the right of the listbox but instead is located at the bottom just to the right. How can I place the scrollbar to the side and right of listbox?

lbframe=Frame(rooms, height=50, width=70, border=1)
    lbframe.place(x=40, y=50)

    roomlb = Listbox(lbframe, height=25, width=60, font="courier")
    roomlb.pack()

    scrollbar = Scrollbar(lbframe, orient="vertical")
    scrollbar.config(command=roomlb.yview)
    scrollbar.pack(side="right", fill="y")
    roomlb.config(yscrollcommand=scrollbar.set)



RE: How to place scroll bar correctly - scratchmyhead - May-18-2020

I figured it out. When packing the Listbox, I added the following parameters:

roomlb = Listbox(lbframe, height=25, width=65, font="courier")
roomlb.pack(side="left", fill="y")