Next / Previous / Contents / TCC Help System / NM Tech homepage

18.3. ColorSliders.__init__(): Constructor

The constructor starts by calling its parent class constructor. The calls to .columnconfigure() distribute the width of the included columns equally (weight) and assign a minimum column size (minsize).

huey
# - - -   C o l o r S l i d e r s . _ _ i n i t _ _

    def __init__ ( self, parent, color, callback ):
        """Constructor for the ColorSliders widget.
        """
        #-- 1 --
        # [ parent  :=  parent with a new Frame added but not
        #               gridded
        #   self  :=  that Frame ]
        Frame.__init__ ( self, parent )
        self.columnconfigure ( 0, weight=1, minsize="80" )
        self.columnconfigure ( 1, weight=1, minsize="80" )
        self.columnconfigure ( 2, weight=1, minsize="80" )

Then it creates the initial color (red) and model (HSV), and calls Section 18.4, “ColorSliders.__createWidgets() to create its internal widgets.

huey
        #-- 2 --
        # [ self.__color     :=  red
        #   self.__model     :=  the HSV color model
        #   self.__callback  :=  callback ]
        self.__color  =  color
        self.__model  =  HSVModel()
        self.__callback  =  None

        #-- 3 --
        # [ self  :=  self with all internal widgets created and
        #             gridded ]
        self.__createWidgets()

        #-- 4 --
        self.__callback  =  callback