Scaling Tk scrollbar handles

G

Gordon Airport

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.
Is there anything I can do about this?
 
M

Michael Peuser

Gordon Airport said:
None of the online references that I'm using or can find tell you if
this can be done.

???
This is really no secret!
E.g. look at at New Mexico Tech
http://www.nmt.edu/tcc/help/pubs/lang.html
There are two very concise as well as comprehensive documents. One about Tk,
one about Python.

scrollbar.set(a,b)

where a is the fraction (0..1) where the thumb shall start and b where it
should end...

Kindly
Michael P
 
G

Gordon Airport

Thanks, I hadn't seen those. There are quite a few documents about this
out there with highly variable readability, comprehensiveness, and
up-to-date-edness. I think I've been relying on the effbot documents too
much.
 
F

Fredrik Lundh

Gordon said:
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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top