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


Python tkColorChooser.askcolor函数代码示例

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


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

示例1: on_mouse_release

 def on_mouse_release(self, x, y, buttons, modifers):
     if self.highlighted is not None:
         if pyglet.window.mouse.LEFT & buttons:
             self.dispatch_event("on_tool_selected", self.highlighted,
                                 "left")
             self.left_tool = self.highlighted
         else:
             self.dispatch_event("on_tool_selected", self.highlighted,
                                 "right")
             self.right_tool = self.highlighted
     elif self.over_palette_swatch(x, y):
         swatch, index = self.get_palette_swatch(x, y)
         if pyglet.window.key.MOD_CTRL & modifers:
             self.palette[index] = askcolor()[0] or self.palette[index]
         elif pyglet.window.mouse.LEFT & buttons:
             self.dispatch_event("on_color_selected", swatch,
                                 "left")
             self.left_color = swatch
         else:
             self.dispatch_event("on_color_selected", swatch,
                                 "right")
             self.right_color = swatch
     elif self.scale_increased(x, y):
         self.scale += 1
         self.dispatch_event("on_scale_changed", self.scale)
     elif self.scale_decreased(x ,y):
         self.scale = max(1, self.scale - 1)
         self.dispatch_event("on_scale_changed", self.scale)
     elif x > self.tool_loc[-1][0] and y > self.tool_loc[-1][1]:
         new_bg_color = askcolor()[0]
         if new_bg_color:
             self.background_color = new_bg_color
             self.dispatch_event("on_bg_color_selected", new_bg_color)
开发者ID:spirulence,项目名称:pixelslammer,代码行数:33,代码来源:view.py

示例2: open_new

    def open_new (self):
        n_col = tkSimpleDialog.askinteger ("N_Colors", "Enter the number "\
                                           "of colors in new lookup table.",
                                           initialvalue=16, 
                                           minvalue=0,
                                           maxvalue=LUT_EDITOR_MAX_COLORS,
                                           parent=self.root)
        if n_col is None:
            return None

        cur_col = ((0,0,255), '#0000fe')
        ans = tkMessageBox.askyesno ("Choose color?", 
                                     "Choose individual colors? "\
                                     "Answer no to choose one color only.")
        if ans == 1:        
            for i in range (0, n_col):
                col = tkColorChooser.askcolor (title="Color number %d"%(i),
                                               initialcolor=cur_col[1])
                if col[1] is not None:
                    self.lut.append (tk_2_lut_color (col[0]))
                    cur_col = col
                else:
                    self.lut.append (tk_2_lut_color (cur_col[0]))
        else:
            col = tkColorChooser.askcolor (title="Choose default color", 
                                           initialcolor=cur_col[1])
            if col[1] is None:
                col = cur_col
            for i in range (0, n_col):
                self.lut.append (tk_2_lut_color (col[0]))
            
        self.lut_changed = 1
        self.initialize ()
开发者ID:sldion,项目名称:DNACC,代码行数:33,代码来源:Lut_Editor.py

示例3: chooseColor

 def chooseColor(self, textbox):
     previous = textbox.getValue()
     try:
         color = tkColorChooser.askcolor(previous)[1]
     except:
         color = tkColorChooser.askcolor()[1]
     if color is None:
         color = previous
     textbox.setValue(color)
开发者ID:kahvel,项目名称:VEP-BCI-OLD,代码行数:9,代码来源:Textboxes.py

示例4: _select_color

 def _select_color( self):
   if self.color:
     color = tkColorChooser.askcolor( self.color)
   else:
     color = tkColorChooser.askcolor()
   if color[1]:
     self.set_color( color[1])
     self.rgb = color[0]
     self.configure( background=self.color, activebackground=self.color,
                     activeforeground=self.foreground_color, foreground=self.foreground_color)
开发者ID:bartlebee,项目名称:bkchem,代码行数:10,代码来源:widgets.py

示例5: color_map

def color_map(gfx,butcolor):
	'''
	if gfx.map==[]:
		MB.showwarning('Info','Select map file')
		return
	'''
	if gfx.map!=[]:
		new_color = tkColorChooser.askcolor (title="Map color",initialcolor=mod.vtk2tk_color(gfx.map[0].color))
	else:
		new_color = tkColorChooser.askcolor (title="Map color",initialcolor=mod.vtk2tk_color((0,0.5,0.75)))
	if new_color[1] != None:
		    	col = mod.tk2vtk_color (new_color[0])
    			butcolor.config(bg=mod.vtk2tkhex_color(col))
开发者ID:ggoret,项目名称:VEDA,代码行数:13,代码来源:Map.py

示例6: color_callback

 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:Alzarath,项目名称:RebirthItemTracker,代码行数:7,代码来源:option_picker.py

示例7: clearClick

def clearClick(event):
	if(zoom_flag != 0):
		return
	global p
	p = [0,'#ffffff'] 
	p = askcolor() 
	w.bind('<Button-1>', click)
开发者ID:p3ncoders,项目名称:paint,代码行数:7,代码来源:paint.py

示例8: _chooseColor

 def _chooseColor( event=None ):
    import tkColorChooser
    
    newColor = tkColorChooser.askcolor( parent=self )[1]
    if newColor:
       variable.set( newColor )
       self.newColorChosen( variable )
开发者ID:ChristianBagley,项目名称:mindtree,代码行数:7,代码来源:DocumentWriter.py

示例9: chooseClr

def chooseClr(button, protname, chem) :
	retclr = tkColorChooser.askcolor()
	if not retclr[0] : return
	clr = retclr[0]
	button.config(foreground=retclr[1])
	vorshows[protname].chem2clr[chem] = ( clr[0]/256., clr[1]/256., clr[2]/256. )
	print vorshows[protname].chem2clr
开发者ID:watarunemoto,项目名称:provat,代码行数:7,代码来源:provat_plugin.py

示例10: setColor

def setColor():
    #    global log
    col = tkColorChooser.askcolor()
    # workaround: on linux col[1] returns object, not string
    col2 = isinstance(col[1], str) and col[1] or col[1].string
    log.config(background=col2)
    statusHint("Color set to: " + col2)
开发者ID:elFua,项目名称:pydictionary,代码行数:7,代码来源:pydsl2htmtk.py

示例11: set_layer_color

 def set_layer_color(self, layer_id):
     layer = self.get_layer(layer_id)
     color = tkColorChooser.askcolor(color=layer.color)[0]
     
     if color != None:
         layer.color = color
     self.select_layer(layer_id)
开发者ID:sbobovyc,项目名称:DCS,代码行数:7,代码来源:Controller.py

示例12: colorChooser

 def colorChooser(self,option,widget):
   """ Gets the name of the color from the color dialog """
   color = askcolor()
   if( color and len(color) > 1 and color[0] != None ):
     widget.delete(0,len( widget.get() ) )
     widget.insert(0, str(color[1]) )
     self.widgetDict[option] = widget      
开发者ID:pombreda,项目名称:comp304,代码行数:7,代码来源:OptionDialog.py

示例13: toggle

 def toggle(self):
     if self.variable.get() == 1:
         color1 = tkColorChooser.askcolor(title="Choose first color")[0] 
         if color1 != None:
             color2 = tkColorChooser.askcolor(title="Choose second color")[0]
         else:
             self.deselect()
             return
         
         if color2 != None:
             self.controller.set_filter(color1, color2)
         else:
             self.deselect()
     else:
         print "Toggle"
         self.controller.unset_filter()
开发者ID:sbobovyc,项目名称:DCS,代码行数:16,代码来源:color_filter.py

示例14: changeColour

def changeColour():
    global colour1,colFrame1
    (rgb, hexColour) = tkcc.askcolor()
    colour1 = hexColour
    print(colour1)
    updateFile()
    colFrame1.config(bg = hexColour)
开发者ID:nitishkumarranjan,项目名称:NITS,代码行数:7,代码来源:Settings_Tab.py

示例15: update_relbuttons

def update_relbuttons(gw,relbuttons):
    for child in relbuttons.winfo_children():
        child.destroy()
    lb = Label(relbuttons,text="State: {}".format(gw.parent.state_label(gw.g.parent_state)))
    lb.pack(side = TOP)
    btns = Frame(relbuttons)
    btns.pack(side = TOP)
    foo = Label(btns,text = '+')
    foo.grid(row = 0, column = 0)
    foo = Label(btns,text = '?')
    foo.grid(row = 0, column = 1)
    foo = Label(btns,text = '-')
    foo.grid(row = 0, column = 2)
    foo = Label(btns,text = 'T')
    foo.grid(row = 0, column = 4)
    rels = sorted(gw.g.relations,key=lambda r:r.name())
    for idx,rel in enumerate(rels):
        foo = Checkbutton(btns,fg=line_color(idx),variable=gw.get_enabled(rel)[0],command=gw.update)
        foo.grid(row = idx+1, column = 0)
        foo = Checkbutton(btns,fg=line_color(idx),variable=gw.get_enabled(rel)[1],command=gw.update)
        foo.grid(row = idx+1, column = 1)
        foo = Checkbutton(btns,fg=line_color(idx),variable=gw.get_enabled(rel)[2],command=gw.update)
        foo.grid(row = idx+1, column = 2)
        foo = Label(btns,text=rel.name(),fg=line_color(idx),justify=LEFT,anchor="w")
        foo.grid(sticky=W,row = idx+1, column = 3)
        foo.bind("<Button-1>", lambda e: askcolor())
        foo = Checkbutton(btns,fg=line_color(idx),variable=gw.get_enabled(rel)[3],command=gw.update)
        foo.grid(row = idx+1, column = 4)
开发者ID:simudream,项目名称:ivy,代码行数:28,代码来源:ivy_graph_ui.py


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