本文整理汇总了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)
示例2:
# 需要导入模块: import ColorDB [as 别名]
# 或者: from ColorDB import triplet_to_brightness [as 别名]
"""Strip viewer and related widgets.