Tkinter, problem when using 2 scrollbars

jepler at unpythonic.net jepler at unpythonic.net
Sun Oct 20 19:12:58 EDT 2002


On Mon, Oct 21, 2002 at 12:31:41AM +0200, Roberto Ferreras wrote:
> First, it's my first program with Tkinter ...
> 
> Ok, I have a Listbox with two Scrollbars around it. But they "overlap" at
> the bottom right corner. One is a bit larger than the other, ie, the
> verticall scrollbar goes from the top of the Listbox to the bottom of the
> horizontal Scrollbar.
> 
> How can I avoid that? How can I put an empty square so the vertical Sb has
> the height of the Lb and the horizontal Sb the width of the Lb?

If you use "pack", you'll end up with either this
	TTTT S
        TTTT S
        TTTT S

        SSSSSS
or this:
	TTTT S
        TTTT S
        TTTT S
             S
        SSSS S

You must use the "grid" manager.  Place the text in row=0, column=0, the
scrollbars in row=1, column=0 and row=0, column=1, and nothing in row=1,
column=1.  Mess with "sticky" on the widgets and "row/columnweight" on the
master until you get something that behaves properly.

I'd whip something up real quick, but I don't have Tk on this machine.

Jeff




More information about the Python-list mailing list