Scaling Tk scrollbar handles

Fredrik Lundh fredrik at pythonware.com
Sun Sep 21 03:22:40 EDT 2003


Gordon Airport wrote:

> None of the online references that I'm using or can find tell you if
> this can be done. It's standard practice in GUI's to have the handle of
> a scrollbar sized to be the proportion of total ammount of viewable data
> to the ammount you can see in the current view region. (I think that
> explains it, you know what I mean.) I have a scrollbar attached to a
> canvas, and it scrolls properly, but it always has a tiny little handle.

by default, the canvas tells the scrollbars that the canvas surface is
unbounded (-maxfloat to +maxfloat); no matter how you scroll around,
you're only seeing a very small portion of the available coordinate
space.

to get the behaviour you're after, set the "scrollregion" option.

for some more background and code samples, see:

    http://www.effbot.org/zone/tkinter-scrollbar-patterns.htm#canvas
    http://www.effbot.org/zone/tkinter-scrollbar-patterns.htm#canvas

</F>








More information about the Python-list mailing list