By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,590 Members | 1,477 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,590 IT Pros & Developers. It's quick & easy.

Tkinter and Scrollbar

P: n/a
I am trying to use a Scrollbar for a Listbox. I want a scrollbar
which which has the vertical and horizontal scroll bars. Here is how i
am doing it now, is the only way or "best" way to do it?
# vertical scroll bar for list
self._scrollbarY = Scrollbar(self.myContainer)
self._scrollbarY.pack(side=RIGHT, fill=Y)

# horizontal scroll bar for list
self._scrollbarX = Scrollbar(self.myContainer,
self._scrollbarX.pack(side=BOTTOM, fill=X)

self._list = Listbox(self.myContainer)

for i in range(100):
self._list.insert(END, "a"*i)

self._list.config(yscrollcommand=self._scrollbarY. set)
self._list.config(xscrollcommand=self._scrollbarX. set)
self._scrollbarY.config(command = self._list.yview)
self._scrollbarX.config(command = self._list.xview)

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.