Tk Scrollbars

Tamito Kajiyama kajiyama at grad.sccs.chukyo-u.ac.jp
Wed Mar 8 19:56:59 EST 2000


"T Zimmerman" <tzman at bhmi.com> writes:
>
>     This seems to be a simple question, but one I havent been able to figure
> out very easily. I have placed a scrollbar in a pane for horizontal
> scrolling of a canvas.  The problem is that the scrollbar disappears if the
> window gets to small. The window isnt small enough that this should happen.
> Any ideas as to what causes this or how to fix it?

You did not mention what windowing toolkit you have used, so I
assume that you are using Tkinter.

I believe that the cause of your problem is the order of packing
widgets (the scrollbar and canvas in this case).  When a window
gets small, the remaining space is devoted to the widgets that
are packed later than others.  In other words, the widget that
is packed first will disappear first.

Here are two examples illustrating this idea; see what happens
when you make the window small.

  >>> from Tkinter import *
  >>> Scrollbar().pack(side=RIGHT, fill=Y)
  >>> Text().pack(side=LEFT, fill=BOTH)

  >>> from Tkinter import *
  >>> Text().pack(side=LEFT, fill=BOTH)
  >>> Scrollbar().pack(side=RIGHT, fill=Y)

Regards,

-- 
KAJIYAMA, Tamito <kajiyama at grad.sccs.chukyo-u.ac.jp>
--
KAJIYAMA, Tamito <kajiyama at grad.sccs.chukyo-u.ac.jp>



More information about the Python-list mailing list