本文整理汇总了Python中Main.initial_color方法的典型用法代码示例。如果您正苦于以下问题:Python Main.initial_color方法的具体用法?Python Main.initial_color怎么用?Python Main.initial_color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Main
的用法示例。
在下文中一共展示了Main.initial_color方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show
# 需要导入模块: import Main [as 别名]
# 或者: from Main import initial_color [as 别名]
def show(self, color, options):
# scan for options that can override the ctor options
self.__wantspec = options.get('wantspec', self.__wantspec)
dbfile = options.get('databasefile', self.__databasefile)
# load the database file
colordb = None
if dbfile <> self.__databasefile:
colordb = ColorDB.get_colordb(dbfile)
if not self.__master:
from Tkinter import Tk
self.__master = Tk()
if not self.__pw:
self.__pw, self.__sb = \
Main.build(master = self.__master,
initfile = self.__initfile,
ignore = self.__ignore)
else:
self.__pw.deiconify()
# convert color
if colordb:
self.__sb.set_colordb(colordb)
else:
colordb = self.__sb.colordb()
if color:
r, g, b = Main.initial_color(color, colordb)
self.__sb.update_views(r, g, b)
# reset the canceled flag and run it
self.__sb.canceled(0)
Main.run(self.__pw, self.__sb)
rgbtuple = self.__sb.current_rgb()
self.__pw.withdraw()
# check to see if the cancel button was pushed
if self.__sb.canceled_p():
return None, None
# Try to return the color name from the database if there is an exact
# match, otherwise use the "#rrggbb" spec. BAW: Forget about color
# aliases for now, maybe later we should return these too.
name = None
if not self.__wantspec:
try:
name = colordb.find_byrgb(rgbtuple)[0]
except ColorDB.BadColor:
pass
if name is None:
name = ColorDB.triplet_to_rrggbb(rgbtuple)
return rgbtuple, name
示例2: implementing
# 需要导入模块: import Main [as 别名]
# 或者: from Main import initial_color [as 别名]
"""Color chooser implementing (almost) the tkColorColor interface