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


Python Main.initial_color方法代码示例

本文整理汇总了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
开发者ID:0xcc,项目名称:python-read,代码行数:48,代码来源:pyColorChooser.py

示例2: implementing

# 需要导入模块: import Main [as 别名]
# 或者: from Main import initial_color [as 别名]
"""Color chooser implementing (almost) the tkColorColor interface
开发者ID:mcyril,项目名称:ravel-ftn,代码行数:3,代码来源:pyColorChooser.py


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