Python traitlets 模块,Float() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用traitlets.Float()

项目:uchroma    作者:cyanogen    | 项目源码 | 文件源码
def __init__(self, driver, led_type: LEDType, *args, **kwargs):
        super(LED, self).__init__(*args, **kwargs)
        self._driver = driver
        self._led_type = led_type
        self._logger = driver.logger
        self.led_type = led_type
        self._restoring = True
        self._refreshing = False
        self._dirty = True

        # dynamic traits, since they are normally class-level
        brightness = Float(min=0.0, max=100.0, default_value=80.0,
                           allow_none=False).tag(config=True)
        color = ColorTrait(default_value=led_type.default_color,
                           allow_none=False).tag(config=led_type.rgb)
        mode = UseEnumCaseless(enum_class=LEDMode, default_value=LEDMode.STATIC,
                               allow_none=False).tag(config=led_type.has_modes)

        self.add_traits(color=color, mode=mode, brightness=brightness)

        self._restoring = False