Next / Previous / Contents / Shipman's homepage

9.2. RGBModel.paramsToColor()

This method takes a tuple (red, green, blue) and returns a color as a Colorinstance. The “*” used inside the call to the Color() constructor takes advantage of one of Python's features: that constructor expects three positional arguments, but since params is a three-element sequence, the “*” tells Python to allocate those three elements to the corresponding positional arguments.

# - - -   R G B M o d e l . p a r a m s T o C o l o r

    def paramsToColor ( self, params ):
        """Convert three RGB parameters to a Color.
        return  Color ( *params )