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


Python tkColorChooser.askcolor方法代码示例

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


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

示例1: GetColour

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def GetColour(self):
        target=self.highlightTarget.get()
        prevColour=self.frameColourSet.cget('bg')
        rgbTuplet, colourString = tkColorChooser.askcolor(parent=self,
            title='Pick new colour for : '+target,initialcolor=prevColour)
        if colourString and (colourString!=prevColour):
            #user didn't cancel, and they chose a new colour
            if self.themeIsBuiltin.get(): #current theme is a built-in
                message=('Your changes will be saved as a new Custom Theme. '+
                        'Enter a name for your new Custom Theme below.')
                newTheme=self.GetNewThemeName(message)
                if not newTheme: #user cancelled custom theme creation
                    return
                else: #create new custom theme based on previously active theme
                    self.CreateNewTheme(newTheme)
                    self.colour.set(colourString)
            else: #current theme is user defined
                self.colour.set(colourString) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:20,代码来源:configDialog.py

示例2: GetColour

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def GetColour(self):
        target = self.highlightTarget.get()
        prevColour = self.frameColourSet.cget('bg')
        rgbTuplet, colourString = tkColorChooser.askcolor(
                parent=self, title='Pick new colour for : '+target,
                initialcolor=prevColour)
        if colourString and (colourString != prevColour):
            #user didn't cancel, and they chose a new colour
            if self.themeIsBuiltin.get():  #current theme is a built-in
                message = ('Your changes will be saved as a new Custom Theme. '
                           'Enter a name for your new Custom Theme below.')
                newTheme = self.GetNewThemeName(message)
                if not newTheme:  #user cancelled custom theme creation
                    return
                else:  #create new custom theme based on previously active theme
                    self.CreateNewTheme(newTheme)
                    self.colour.set(colourString)
            else:  #current theme is user defined
                self.colour.set(colourString) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:21,代码来源:configDialog.py

示例3: AskColor

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def AskColor(text="unknown graphics"):
    """
Pops up a temporary tk window asking user to visually choose a color.
Returns the chosen color as a hex string. Also prints it as text in case
the user wants to remember which color was picked and hardcode it in the script.

| __option__ | __description__ 
| --- | --- 
| *text | an optional string to identify what purpose the color was chosen for when printing the result as text.
"""
    def askcolor():
        tempwindow = tk.Tk()
        tempwindow.state("withdrawn")
        rgb,hexcolor = tkColorChooser.askcolor(parent=tempwindow, title="choose color for "+text) ;
        tempwindow.destroy()
        print("you picked the following color for "+str(text)+": "+str(hexcolor))
        return hexcolor
    hexcolor = askcolor()
    return colour.Color(hexcolor).hex

#GENERAL UTILITIES 
开发者ID:karimbahgat,项目名称:GeoVis,代码行数:23,代码来源:__init__.py

示例4: themecolorbrowse

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def themecolorbrowse(self, index):
        (rgb, color) = tkColorChooser.askcolor(self.theme_colors[index], title=self.theme_prompts[index], parent=self.parent)
        if color:
            self.theme_colors[index] = color
            self.themevarchanged() 
开发者ID:EDCD,项目名称:EDMarketConnector,代码行数:7,代码来源:prefs.py

示例5: add_color_to_palette

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def add_color_to_palette(self):
        if (self.curr_palette_string.get() == ""):
            self.palette = [] # this is in case the default palette has already been used in a previous build
        color = tkColorChooser.askcolor()
        dprint("New color added to palette", color)
        rgb_color = color[0]
        hsv_color = colorsys.rgb_to_hsv(rgb_color[0]/255.0, rgb_color[1]/255.0, rgb_color[2]/255.0)
        hsv = {"hue": int(hsv_color[0]*360), "saturation": int(hsv_color[1]*100), "brightness": int(hsv_color[2]*100)}
        self.palette.append(hsv)
        self.curr_palette_string.set(self.curr_palette_string.get() + json.dumps(hsv) + '\n') 
开发者ID:nanoleaf,项目名称:aurora-sdk-mac,代码行数:12,代码来源:main.py

示例6: change_cursor

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def change_cursor():
    global fill
    color = tkColorChooser.askcolor(color=fill)[1]
    if color is not None:
        fill = color 
开发者ID:ActiveState,项目名称:code,代码行数:7,代码来源:recipe-511434.py

示例7: change_canvas

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def change_canvas():
    color = tkColorChooser.askcolor(color=draw['bg'])[1]
    if color is not None:
        draw['bg'] = color
        draw.config(bg=color)
        call('config', bg=color)

################################################################################ 
开发者ID:ActiveState,项目名称:code,代码行数:10,代码来源:recipe-511434.py

示例8: changeColor

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def changeColor(self,*args):
        color = askcolor(self.color_data.get())
        self.color_data.set(color[1]) 
开发者ID:digiholic,项目名称:universalSmashSystem,代码行数:5,代码来源:createMask.py

示例9: choose_color

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def choose_color():
  color = _tkColorChooser.askcolor()
  new_color = (color[0][0], color[0][1], color[0][2])
  return new_color

# --------------------------------------------------------------------

##
## Color Constants
## 
开发者ID:otfried,项目名称:cs101,代码行数:12,代码来源:cs1media.py

示例10: color_callback

# 需要导入模块: import tkColorChooser [as 别名]
# 或者: from tkColorChooser import askcolor [as 别名]
def color_callback(self, source):
        # Prompt a color picker, set the options and the background/foreground of the button
        nums, hex_color = askcolor(color=getattr(self.options, source), title="Color Chooser")
        if hex_color:
            opposite = self.opposite_color(hex_color)
            setattr(self.options, source, hex_color.upper())
            self.buttons[source].configure(bg=hex_color, fg=opposite) 
开发者ID:Hyphen-ated,项目名称:RebirthItemTracker,代码行数:9,代码来源:option_picker.py


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