Python Forum

Full Version: How to place scroll bar correctly
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
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")