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

15.7. Adjuster.__createWidgets(): Create internal widgets

There are three contained widgets, stacked vertically in column 0 of the grid.

huey
# - - -   A d j u s t e r . _ _ c r e a t e W i d g e t s

    def __createWidgets ( self ):
        """Create and grid all internal widgets
        """

First is the ColorReadout widget that displays the selected colors; see Section 16, “class ColorReadout: Text and background color readouts”. The initial colors are defined as manifest class constants; see Section 15.1, “Manifest constants”. The ColorReadout class expects a callback function; we pass it a reference to Section 15.8, “Adjuster.__readoutHandler(): Change between text and background colors”.

huey
        #-- 1 --
        # [ self  :=  self with a new ColorReadout added and gridded
        #       that will call self.__callback() when the user
        #       changes the text/background choice
        #   self.__colorReadout  :=  that new ColorReadout ]
        self.__colorReadout  =  ColorReadout ( self,
            self.DEFAULT_BG_COLOR, self.DEFAULT_TEXT_COLOR,
            self.__readoutHandler )
        rowx  =  0
        self.__colorReadout.grid ( row=rowx, column=0, sticky=E+W )

Next is the ModelSelector widget. It needs a callback function that will be called when the user changes the displayed color model. See Section 17, “class ModelSelector: Widgets to select a color model”.

huey
        #-- 2 --
        # [ self  :=  self with a new ModelSelector added and gridded
        #       that will select the color model displayed in
        #       self.__colorSliders, and call self.__modelHandler
        #       when the color model is changed ]
        self.__modelSelector  =  ModelSelector ( self,
                                 self.__modelHandler )
        rowx  +=  1
        self.__modelSelector.grid ( row=rowx, column=0, sticky=E+W,
            pady=4 )

Last is the ColorSliders widget that displays the current color model parameters. This too has a callback function, called when the user changes any of the current color model parameters. See Section 18, “class ColorSliders: Color model parameter sliders”.

huey
        #-- 3 --
        # [ self  :=  self with a new ColorSliders widget added
        #       that displays the current color model parameters
        #       and calls self.__modelHandler whenever the user
        #       changes a color model parameter
        #   self.__colorSliders  :=  that ColorSliders widget ]
        self.__colorSliders  =  ColorSliders ( self, self.bgColor(),
            self.__sliderHandler )
        rowx  +=  1
        self.__colorSliders.grid ( row=rowx, column=0, sticky=W )