Tkinter, problem when using 2 scrollbars
Roma
wholovesomar at ido.com
Mon Oct 21 04:35:36 EDT 2002
> I'd whip something up real quick, but I don't have Tk on this machine.
>
> Jeff
>
>
How's this:
class ScrolledListbox(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
self.listbox = Listbox(self)
self.listbox.grid(row=0, column=0, sticky=N+E+S+W)
self.vscroll = Scrollbar(self, orient=VERTICAL)
self.vscroll.grid(row=0, column=1, sticky=N+S)
self.hscroll = Scrollbar(self, orient=HORIZONTAL)
self.hscroll.grid(row=1, column=0, sticky=E+W)
self.listbox.config(yscrollcommand=self.vscroll.set)
self.listbox.config(xscrollcommand=self.hscroll.set)
self.vscroll.config(command=self.listbox.yview)
self.hscroll.config(command=self.listbox.xview)
greg
More information about the Python-list
mailing list