Python Forum
[Tkinter] How to place scroll bar correctly
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to place scroll bar correctly
#1
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)

Attached Files

Thumbnail(s)
   
Reply
#2
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")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Place QT Window in the middle AlphaInc 10 1,988 Aug-03-2023, 05:40 PM
Last Post: Axel_Erfurt
  [PyQt] QTableView: scroll to top cell of the screen random_nick 2 2,739 Oct-08-2022, 12:29 AM
Last Post: random_nick
  [PyQt] How do I get a QScrollArea to scroll? LavaCreeperKing 9 7,507 Oct-29-2021, 08:33 AM
Last Post: Axel_Erfurt
  Treeview scroll selected node to top rfresh737 1 2,652 Apr-14-2021, 03:27 AM
Last Post: deanhystad
  [Tkinter] canvas widget scroll issue chrisdb 2 3,755 Apr-07-2021, 05:48 AM
Last Post: chrisdb
  [Tkinter] Help with scroll bars kraco 1 2,191 Sep-27-2020, 11:20 PM
Last Post: Larz60+
  Label.Place did not work? ATARI_LIVE 15 4,980 Sep-18-2020, 04:22 PM
Last Post: ATARI_LIVE
  How to use place holders in tkinter sqlite scratchmyhead 1 1,770 May-12-2020, 06:13 PM
Last Post: Larz60+
  Scroll frame with MouseWheel Nemesis 1 3,524 Mar-25-2020, 09:29 PM
Last Post: Nemesis
  [Kivy] Why I have to click twice to scroll? Hummingbird 0 2,318 Jan-06-2020, 09:08 PM
Last Post: Hummingbird

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020