Next / Previous / Contents / Shipman's homepage

3.2. Methods on a ScrolledList

These methods are defined on a ScrolledList widget.


Returns the number of lines currently contained in the listbox.

.__getitem__(self, i)

To retrieve the text of the ith line in the listbox, you can use the regular Python index operator. For example, if you have a ScrolledList instance named optionBox, the expression “optionBox[2]” would return the contents of the third line.


Adds a string s as the next line in the listbox.

.insert(linex, s)

Inserts a string s as a new line before position linex. For example, to add a new first line containing “Merlin” to a ScrolledList widget named s:

 s.insert(0, 'Merlin')

Deletes a line from the listbox; linex is the index of the line, starting from 0.


Removes all lines from the listbox.