Tk Scrollbar

Gary Herron gherron at aw.sgi.com
Tue Jun 15 12:46:23 EDT 1999


Sven Drescher wrote:
> 
> Hi!
> I have only an easy question. I think it is possible to bind a scrollbar
> and an other widget e.g. a frame with buttons. But I have not found any
> literature or programming examples. I want to bind the scrollbar to an
> frame and I don't know how. Please help me.
> Thanks for links and Python-code or other help.
> 
> Sven

The communication between a widget and a scrollbar is carried out by two
procedures:
  
  1.  The scrollbar calls the widget's "yview" (or "xview") method to
cause it to scroll to a new position.

  2. The widget calls the scrollbar's "set" method to indicate
to invoke a change in the sliders position or size.

The only widgets which implement the "yview" method are "Canvas",
"Listbox", and "Text".  (And to be very clear here, this implementation
and the connection between the two widgets is at the tcl/tk level.)

So...
To add scrolling capabilities to an arbitrary widget, you would need to
implement the "yview" command (in its several versions) on the widget. 
I don't know if this would need to be implemented in tcl, or if you
could rig things so that the scrollbar's call to "yview" would come all
the way back into python so that you could implement it in python.

-- 
Dr. Gary Herron <gherron at aw.sgi.com>
206-287-5616
Alias | Wavefront
1218 3rd Ave, Suite 800, Seattle WA 98101




More information about the Python-list mailing list