当前位置: 首页>>代码示例>>Python>>正文


Python ColorDB.triplet_to_brightness方法代码示例

本文整理汇总了Python中ColorDB.triplet_to_brightness方法的典型用法代码示例。如果您正苦于以下问题:Python ColorDB.triplet_to_brightness方法的具体用法?Python ColorDB.triplet_to_brightness怎么用?Python ColorDB.triplet_to_brightness使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ColorDB的用法示例。


在下文中一共展示了ColorDB.triplet_to_brightness方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __trackarrow

# 需要导入模块: import ColorDB [as 别名]
# 或者: from ColorDB import triplet_to_brightness [as 别名]
    def __trackarrow(self, chip, rgbtuple):
        # invert the last chip
        if self.__lastchip is not None:
            color = self.__canvas.itemcget(self.__lastchip, 'fill')
            self.__canvas.itemconfigure(self.__lastchip, outline=color)
        self.__lastchip = chip
	# get the arrow's text
	coloraxis = rgbtuple[self.__axis]
        if self.__hexp.get():
            # hex
            text = hex(coloraxis)
        else:
            # decimal
            text = repr(coloraxis)
	# move the arrow, and set it's text
	if coloraxis <= 128:
	    # use the left arrow
	    self.__leftarrow.set_text(text)
	    self.__leftarrow.move_to(self.__arrow_x(chip-1))
	    self.__rightarrow.move_to(-100)
	else:
	    # use the right arrow
	    self.__rightarrow.set_text(text)
	    self.__rightarrow.move_to(self.__arrow_x(chip-1))
	    self.__leftarrow.move_to(-100)
	# and set the chip's outline
        brightness = ColorDB.triplet_to_brightness(rgbtuple)
	if brightness <= 128:
	    outline = 'white'
	else:
	    outline = 'black'
	self.__canvas.itemconfigure(chip, outline=outline)
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:34,代码来源:StripViewer.py

示例2:

# 需要导入模块: import ColorDB [as 别名]
# 或者: from ColorDB import triplet_to_brightness [as 别名]
"""Strip viewer and related widgets.
开发者ID:mcyril,项目名称:ravel-ftn,代码行数:3,代码来源:StripViewer.py


注:本文中的ColorDB.triplet_to_brightness方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。