Next / Previous / Contents / Shipman's homepage

5.4. class ScrolledList

Here we start the actual class declaration for ScrolledList.

scrolledlist.py
class ScrolledList(tk.Frame):
    """A compound widget containing a listbox and up to two scrollbars.

Inside the class's documentation string, we document the public and internal attributes. The scrollbar widgets are technically public, in case anyone wants to configure their attributes.

scrolledlist.py
      State/invariants:
        .listbox:      [ The Listbox widget ]
        .vScrollbar:
           [ if self has a vertical scrollbar ->
               that scrollbar
             else -> None ]
        .hScrollbar:
           [ if self has a vertical scrollbar ->
               that scrollbar
             else -> None ]
        .callback:     [ as passed to constructor ]
        .vscroll:      [ as passed to constructor ]
        .hscroll:      [ as passed to constructor ]
    """