當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。