Tkinter and Scrollbar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • codecraig

    #1

    Tkinter and Scrollbar

    Hi,
    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._scrollbar Y = Scrollbar(self. myContainer)
    self._scrollbar Y.pack(side=RIG HT, fill=Y)

    # horizontal scroll bar for list
    self._scrollbar X = Scrollbar(self. myContainer,
    orient=HORIZONT AL)
    self._scrollbar X.pack(side=BOT TOM, fill=X)

    self._list = Listbox(self.my Container)
    self._list.pack ()

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

    self._list.conf ig(yscrollcomma nd=self._scroll barY.set)
    self._list.conf ig(xscrollcomma nd=self._scroll barX.set)
    self._scrollbar Y.config(comman d = self._list.yvie w)
    self._scrollbar X.config(comman d = self._list.xvie w)


    Thanks.

Working...