I had to do this recently where one scroll bar needed to control two canvases.
The trick is to create a function which accepts info from the scrollbar and
then propagates it to the widgets to be scrolled. Some snippets from my code:
hscroll = Scrollbar(FF,orient=HORIZONTAL,command=Propagator)
def Propagator(*Args):
"""
Propagate position commands to more than one canvas.
"""
for C in MyCanvases:
C.xview(*Args)
Where "MyCanvases" is a list of the objects (in my case, Canvases) which need
to scroll in response to changes in the scroll bar.
Hope this helps
Cam
solaris_1234 wrote:
> Is there a way to get a Scrollbar widget to control two widgets?
>
> I would like to do something like:
> ...
> self.textbox1 = Text(self.myc, yscrollbarcommand=self.scrollbar1.set)
> self.textbox2 = Text(self.myc, yscrollbarcommand=self.scrollbar1.set)
> self.scrollbar1.config(command=self.textbox1.yview)
> self.scrollbar1.config(command=self.textbox2.yview)
> ....
>
> I understand the second self.scrollbar1.config is the only valid binding
> for scrollbar1.
>
> Any hints on how to do this ?
>
> Thanks,
>
> tkinter newbie
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss