Next / Previous / Contents / Shipman's homepage

16.3. ColorReadout.internalSet()

This method actually displays the new color. It does not call the user's callback; it is used when the color change happens internal to the Adjuster widget. Originally, a change to the color sliders called the .set() method, but this lead to an infinite loop: the sliders called ColorReadout.set() which called its callback which told the sliders about the new color, and around and around we go until we reach the Python recursion limit.

# - - -   C o l o r R e a d o u t . i n t e r n a l S e t

    def internalSet ( self, color ):
        """Change the currently selected color without calling callbacks.

          [ color is a Color instance ->
              if self.isText() ->
                self's text color  :=  color
              else ->
                self's background color  :=  color ]
        if  self.isText():
            self.__textColor  =  color
            self.__textColorVar.set ( str ( color ) )
            self.__bgColor  =  color
            self.__bgColorVar.set ( str ( color ) )