January 17th, 2005, 04:39 PM
Listbox and Scrollbar
I have created a listbox with a corresponding scrollbar.
When I add text to the listbox, under a conversation. The scrollbar doesnt go down automatically when the listbox is full of text. I have to manually move the scrollbar in order to view the latest received text. I havent found any options to let the scrollbar move automatically. Which would be the most logic and naturally way.
Any idea to solve this?
# create a simple label above the listbox
h = Label(frame, text=string,fg=self.FG,font=('arial','12','bold'),justify=LEFT)
# insert a scrollbar to the listbox
self.yScroll = Scrollbar(frame, orient=VERTICAL)
lbox = Listbox(frame,fg=self.FG,bg=self.BG,\
January 18th, 2005, 01:44 AM
Without knowing something about the GUI library you are using it's somewhat difficult to give an advice.
Usually listbox classes have a method to make a specific listbox item visible (e.g. "see" for a TCL/TK listbox or "EnsureVisible" for a wxPyton wxListCtrl). Applying this method for the latest received text should scroll the list to make it visible and move the scrollbar automagically.
January 18th, 2005, 05:08 AM
A Listbox has a function called see. I guess this is what you are looking for. Here is a little snippet to show it in action:
from Tkinter import *
root = Tk()
l = Listbox()
scroll = Scrollbar(orient=VERTICAL)
for i in range(20):
January 19th, 2005, 04:05 PM
Thanks... see was the function I was looking for.