Tkinter and Scrollbar

Discussion in 'Python' started by codecraig, Apr 19, 2005.

  1. codecraig

    codecraig Guest

    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._scrollbarY = Scrollbar(self.myContainer)
    self._scrollbarY.pack(side=RIGHT, fill=Y)

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

    self._list = Listbox(self.myContainer)
    self._list.pack()

    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)


    Thanks.
    codecraig, Apr 19, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    935
  2. Dustan

    Tkinter Scrollbar not working

    Dustan, Jan 2, 2006, in forum: Python
    Replies:
    8
    Views:
    553
    Dustan
    Jan 3, 2006
  3. spohle
    Replies:
    1
    Views:
    314
    Simon Forman
    Jun 24, 2006
  4. goldtech

    Tkinter scrollbar and checkbox

    goldtech, Apr 24, 2008, in forum: Python
    Replies:
    2
    Views:
    874
    goldtech
    Apr 25, 2008
  5. Alex

    ScrollBar? Does it exist just WEB ScrollBar Control?

    Alex, Apr 1, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    264
    Alvin Bruney [MVP]
    Apr 4, 2004
Loading...

Share This Page