Next / Previous / Contents / Shipman's homepage

5.5. ScrolledList.__init__(): Constructor

The constructor defines default values for all the keyword arguments. Note that the vertical scrollbar is on by default, while the horizontal scrollbar is off by default. See Section 5.3.1, “DEFAULT_WIDTH: Default list width” and Section 5.3.2, “DEFAULT_HEIGHT: Default list height”.
    def __init__(self, master=None, width=DEFAULT_WIDTH,
                 height=DEFAULT_HEIGHT, vscroll=1, hscroll=0,
        """Constructor for ScrolledList.

The constructor's first job is to call the constructor for its parent class, Frame.
        #-- 1
        # [ self  :=  a new Frame widget child of master ]
        tk.Frame.__init__(self, master)

Next, we store the various constructor arguments inside the instance.
        #-- 2
        self.width    = width
        self.height   = height
        self.vscroll  = vscroll
        self.hscroll  = hscroll
        self.callback = callback

Finally, we lay out the internal widgets.
        #-- 3
        # [ self  :=  self with all widgets created and registered ]