• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tkColorChooser.askcolor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: chgCol

 def chgCol(gl=gl, b1=b1, l1=l1):
     tmp = askcolor(gl.color.get())[1]
     if tmp is None: return
     gl.color.set(tmp)
     b1.configure(bg=gl.color.get())
     l1.configure(text=gl.color.get())
     change_cmd()
开发者ID:thompson783,项目名称:lazercam,代码行数:7,代码来源:LayerEditor.py


示例17: ask_color_axis_bgcolor

 def ask_color_axis_bgcolor(self, *args, **kwargs):
     logging.debug("clicked axis_bgcolor button")
     result = tkColorChooser.askcolor(parent=self.master, initialcolor=None, title="axis_bgclor")
     ttk.Style().configure("axis_bgcolor.TButton", background=result[1])
     logging.debug("setting axis_bgcolor to chose color %s" % (repr(result)))
     plt.colors()
     self.mAxes.set_axis_bgcolor(result[1])
开发者ID:GaryHendrick,项目名称:MatplotStylist,代码行数:7,代码来源:stylist.py


示例18: changeColor

def changeColor() :
	assert len(pyncData.intlist.curselection()) == 1
	intname = pyncData.intlist.get(pyncData.intlist.curselection()[0])
	curfile = pyncData.curfile.get()
	retclr = tkColorChooser.askcolor()
	if not retclr[0] : return
	pyncData.files[curfile][1][intname] = [retclr[0][0]/256., retclr[0][1]/256., retclr[0][2]/256.]
开发者ID:watarunemoto,项目名称:provat,代码行数:7,代码来源:pync.py


示例19: add_specific_colour

 def add_specific_colour(self):
     if self.colGridLength >= self.maxValues:
         play_sound()
     else:
         _, hx = tkColorChooser.askcolor()
         if hx != None:
             self._add_colour(hx)
开发者ID:JFDesigner,项目名称:LichtensteinGenerator,代码行数:7,代码来源:lichtensteinGUI.py


示例20: color_choose

 def color_choose(self,attr):
     # print "color_choose", attr
     c = None
     i = -999
     t = ['fg','bg','gridcolor']
     try:
         j = t.index(attr)
         c = self.plot_opts[attr]
         i = - (j + 10)
     except ValueError:
         try:
             i = int(attr)
             c = self.plot_opts['traces'][i][0]
         except ValueError:
             pass
     if (c != None):
         s  = tkColorChooser.askcolor(color= c,parent=self.master)
         nc = s[1]  # nc = new color
         if ((nc == "") or (nc == None)): nc = c
     if (i != -999):
         # bg, fg, gridcolor
         if (i < 0):
             qwid = t[-(i+10)]
             self.plot_opts[qwid] = nc
         # trace#N
         else:
             qwid = 'color#%i' % (i)
             self.plot_opts['traces'][i][0] = nc
         #
         self.opts[qwid].configure(background=nc,
                                  activebackground = nc)
     self.do_plot()
开发者ID:bruceravel,项目名称:ifeffit,代码行数:32,代码来源:DataPlotter.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tkFileDialog.askdirectory函数代码示例发布时间:2022-05-27
下一篇:
Python util.callfcn函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap