Scroll bars with tkinter - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Scroll bars with tkinter

St. JimmySt. Jimmy Posts: 3Member
Hello,
I have a GUI that I made up and inside it is a listbox, I got the scroll bar linked to the listbox. The problem I'm having is that the scroll bar is not stretched to the size of the list box. I can't seem a find a solution to this since I am not using pack() or making my GUI with classes since I am fairly new to this. Any one have any advice to getting the scroll bar to fit the list box?

Thank you for any advice that you guys can give.

Comments

  • DrostDrost Posts: 24Member
    : Hello,
    : I have a GUI that I made up and inside it is a listbox, I got the scroll bar linked to the listbox. The problem I'm having is that the scroll bar is not stretched to the size of the list box. I can't seem a find a solution to this since I am not using pack() or making my GUI with classes since I am fairly new to this. Any one have any advice to getting the scroll bar to fit the list box?
    :
    : Thank you for any advice that you guys can give.

    Hi, how about:

    [code]
    from Tkinter import *

    root = Tk()

    scrollbar = Scrollbar(root)
    scrollbar.grid(column=1, row=0, [blue]sticky='NS'[/blue])

    listbox = Listbox(root, yscrollcommand=scrollbar.set)
    for i in range(1000):
    listbox.insert(END, str(i))
    listbox.grid(column=0, row=0)

    scrollbar.config(command=listbox.yview)

    mainloop()
    [/code]

    [italic]Codesnippet taken from (with slight changes):
    http://www.pythonware.com/library/tkinter/introduction/index.htm
    [/italic]

    That blue part makes the widget (using the grid geometry manager) to take up the remaining space in the directions given (N=north, S=south, E=east, W=west).

    I don't know whether that was the problem or...

    Drost
Sign In or Register to comment.