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


Python tkFont.nametofont函数代码示例

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


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

示例1: deck_options

    def deck_options(self,decknum):
        if not self.deckopt:
            self.deckopt = Toplevel(self)
            self.deckopt.resizable(0,0)
            self.deckopt.protocol('WM_DELETE_WINDOW', self.close_deck_opt)
            self.current_deckopt_num = decknum-1

            custom_title = Label(self.deckopt,text="Deck %i options:"%decknum,font=tkFont.nametofont("TkTextFont"))
            custom_title.grid(row=0,column=0)
            
            self.deckopt_button = Button(self.deckopt, text="Deck %i enabled"%decknum,font=self.mediumfont, command=self.config_deckbutton)
            self.deckopt_button.grid(row=1,column=0)
            if self.current_deckopt_num in defines.DECKS_TO_USE:
                self.deckopt_button.configure(background="#00ff00",text="Deck %i Enabled "%decknum)
            else:
                self.deckopt_button.configure(background="#ff0000",text="Deck %i Disabled"%decknum)

            self.target = IntVar()
            self.target.set(defines.TARGETING[self.current_deckopt_num])
            Label(self.deckopt,text="Targeting preference:",         font=tkFont.nametofont("TkTextFont")).grid(row=2,column=0,sticky=W)
            Radiobutton(self.deckopt, text="No targeting",           font=tkFont.nametofont("TkTextFont"), variable=self.target, value=0, command=self.config_preferences).grid(row=3,column=0,sticky=W)
            Radiobutton(self.deckopt, text="Opponent hero",          font=tkFont.nametofont("TkTextFont"), variable=self.target, value=1, command=self.config_preferences).grid(row=4,column=0,sticky=W)
            #Radiobutton(self.deckopt, text="Enemy taunt minion",     font=tkFont.nametofont("TkTextFont"), variable=self.target, value=2, command=self.config_preferences).grid(row=5,column=0,sticky=W)
            #Radiobutton(self.deckopt, text="Random friendly minion", font=tkFont.nametofont("TkTextFont"), variable=self.target, value=3, command=self.config_preferences).grid(row=6,column=0,sticky=W)

        else:
            self.close_deck_opt()
            self.deck_options(decknum)
开发者ID:schultem,项目名称:HSBOT,代码行数:28,代码来源:play.py

示例2: lables

    def lables(self):
        ''' displays the labels on the main page'''
        font.nametofont('TkDefaultFont').configure(size=15)
        MyFont = font.Font(size=20)#Changes the font size
        self.labelItems = Label(root,text="Items", font=MyFont)
        self.labelItems.configure(background='white')
        self.labelItems.pack()

        self.labelType = Label(root,text="Type")
        self.labelType.configure(background='white')
        self.labelType.place(x=100,y=80)

        self.labelTime = Label(root,text="Time")
        self.labelTime.configure(background='white')
        self.labelTime.place(x=100,y=160)

        self.labelSearching = Label(root,text="Searching")
        self.labelSearching.configure(background='white')
        self.labelSearching.place(x=60,y=240)

        self.labelSorting = Label(root,text="Sorting")
        self.labelSorting.configure(background='white')
        self.labelSorting.place(x=80,y=320)

        self.lableRobotColour = Label(root,text= "Robots colour")
        self.lableRobotColour.configure(background='white')
        self.lableRobotColour.place(x=185,y=400)
开发者ID:msobanjo,项目名称:vrbh_sim,代码行数:27,代码来源:Interface.py

示例3: initialize_font

def initialize_font():
    if "Open Sans" in tkFont.families():
        default_font = tkFont.nametofont("TkDefaultFont")
        default_font.configure(family="Open Sans", size=11)
        
        default_font = tkFont.nametofont("TkTextFont")
        default_font.configure(family="Open Sans", size=11)
开发者ID:jacob-carrier,项目名称:code,代码行数:7,代码来源:recipe-580729.py

示例4: __init__

    def __init__(self, variable_base=None, fixed_base=None):
        if variable_base is None:
            variable_base = tkFont.nametofont("TkDefaultFont")
        if fixed_base is None:
            fixed_base = tkFont.nametofont("TkFixedFont")

        self.default = self.clone_font(variable_base, "default")
        self.fixed = self.clone_font(fixed_base, "fixed")
        self._reset()
开发者ID:Bin-Li,项目名称:robotframework-workbench,代码行数:9,代码来源:fonts.py

示例5: __init__

    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent 
        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        self.mediumfont = tkFont.nametofont("TkFixedFont")
        self.mediumfont.configure(size=22)
        self.mediumfont.configure(family="Helvetica")

        optionsmenu = Menu(menubar, tearoff=0)
        optionsmenu.add_command(label="Custom Decks", command=self.select_decks_to_use)
        optionsmenu.add_command(label="Gameplay", command=self.misc)
        optionsmenu.add_command(label="Controls", command=self.controls)
        optionsmenu.add_command(label="Resolution", command=self.resolutions)
        optionsmenu.add_separator()
        optionsmenu.add_command(label="Exit", command=self.quit)
        menubar.add_cascade(label="Options", menu=optionsmenu)

        helpmenu = Menu(menubar, tearoff=0)
        helpmenu.add_command(label="Help", command=self.help_window)
        helpmenu.add_command(label="Donate Bitcoin!", command=self.donate_window)
        menubar.add_cascade(label="Help", menu=helpmenu)

        self._job_id = None
        self._error  = ""
        self.parent.title(defines.titles[randint(0,len(defines.titles)-1)])
        self.parent.resizable(0,0)

        default_font = tkFont.nametofont("TkDefaultFont")
        default_font.configure(size=42)
        self.led = Button(self,state='disabled')
        self.qmessage = Label(self,text="Edit the decks for the bot to use with Options->Custom_Decks before starting",font=tkFont.nametofont("TkTextFont"))
        self.start_button = Button(self, text="start", command=self.start_click)
        self.stop_button  = Button(self, text="stop", command=self.stop_click)

        self.start_button.grid(row=1,column=0,sticky='N')
        self.stop_button.grid(row=1,column=1,sticky='N')
        self.led.grid(row=1,column=2)
        self.qmessage.grid(row=0,column=0,columnspan=3)

        self.change_led_color("#ff0000"," off ")
        self.stop_button.config(state='disabled')
        
        self.deckopt=False
        self.deckwin=False
        
        self.queue       = Queue.Queue()
        self.logicthread = GameLogicThread(self.queue)
开发者ID:schultem,项目名称:HSBOT,代码行数:49,代码来源:play.py

示例6: zoom_in

 def zoom_in(self, event):
     """ Ctrl+= increases text size """
     self.root.grid_propagate(False)
     font = tkFont.nametofont("CodeFont")
     size = font.actual()["size"]+2
     font.configure(size=size)
     return 'break'
开发者ID:Qirky,项目名称:FoxDot,代码行数:7,代码来源:Editor.py

示例7: __init__

 def __init__(self, parent):
     Frame.__init__(self, parent)
     Worker.__init__(self)
     self.customFont = tkFont.nametofont("TkDefaultFont")
     self.variables = {}
     self.pack()
     self.create_widgets()
开发者ID:ma4ilda,项目名称:imagerenamer,代码行数:7,代码来源:ImageRenamer.py

示例8: zoom_out

 def zoom_out(self, event):
     """ Ctrl+- decreases text size (minimum of 8) """
     self.root.grid_propagate(False)
     font = tkFont.nametofont("CodeFont")
     size = max(8, font.actual()["size"]-2)
     font.configure(size=size)
     return  'break'
开发者ID:Qirky,项目名称:FoxDot,代码行数:7,代码来源:Editor.py

示例9: config_tags

 def config_tags(self):
     """Get style defintions from the friendly local pygments formatter, and
     instantiate them as Tk.Text tag definitions."""
     
     # Discover what 'basefont' currently in use
     curFontName = self.cget('font')
     curFont = tkFont.nametofont(curFontName)
     curFontSpecs = curFont.actual()
     basefont = ' '.join([ str(curFontSpecs[k]) for k in 'family size'.split() ])
     
     # Get tag definitions from our pygments formatter
     styledict = self.formatter.get_style_defs()
     
     # Define our tags accordingly
     for tagName, attTupleList in styledict.iteritems():
         # print "tagconfig:", tagName, tkatts
         for attTuple in attTupleList:
             (attName, attValue) = attTuple
             if attName == 'font':
                 f = basefont.rsplit(' ', 1)
                 f = (f[0], f[1], attValue)
                 self.tag_configure(tagName, font = f)
                 #self.tag_configure(tagName, font = basefont + ' ' + attValue)
             else:
                 attSetter = dict([attTuple])
                 self.tag_configure(tagName, **attSetter)
开发者ID:rpcope1,项目名称:CodePad,代码行数:26,代码来源:pygtext.py

示例10: __init__

    def __init__(self, master, text, background=None, font=None, familiy=None, size=None, underline=True, visited_fg = "#551A8B", normal_fg = "#0000EE", visited=False, action=None):
        self._visited_fg = visited_fg
        self._normal_fg = normal_fg
        
        if visited:
            fg = self._visited_fg
        else:
            fg = self._normal_fg

        if font is None:
            default_font = nametofont("TkDefaultFont")
            family = default_font.cget("family")

            if size is None:
                size = default_font.cget("size")

            font = Font(family=family, size=size, underline=underline)

        Label.__init__(self, master, text=text, fg=fg, cursor="hand2", font=font)

        if background is None:
            background = get_background_of_widget(master)

        self.configure(background=background)

        self._visited = visited
        self._action = action

        self.bind("<Button-1>", self._on_click)
开发者ID:jacob-carrier,项目名称:code,代码行数:29,代码来源:recipe-580774.py

示例11: __init__

    def __init__(self, parent):

        """ My constructor """

        self.tk = Tk()

        # set min and preferred size of main gui
        self.minwinwidth = 300
        self.minwinheight = 300
        screen_width = self.winfo_screenwidth()
        screen_height = self.winfo_screenheight()
        self.preferwinwidth = int(screen_width * 0.8)
        self.preferwinheight = int(screen_height * 0.8)
        self.minsize(width=self.minwinwidth, height=self.minwinheight)
        self.geometry("{}x{}".format(self.preferwinwidth, self.preferwinheight))

        # tweak the aspect ratio of the menu and data gui
        self.menuaspect = [1, 0.15]
        self.dataaspect = [1, 1 - 0.15]
        self.dpi = 80

        # find exect dir
        self.execdir = __file__.split("zfit.py")[0]
        if len(self.execdir) == 0:
            self.execdir = "./"

        # Fiddle with font
        default_font = tkFont.nametofont("TkDefaultFont")
        default_font.configure(size=14)

        # init gui frame
        self.initialize()
开发者ID:mifumagalli,项目名称:mypython,代码行数:32,代码来源:zfit.py

示例12: __init__

	def __init__(self, master, app, *kw, **kwargs):
		Listbox.__init__(self, master, *kw, **kwargs)
		self.bind("<Button-1>",		self.button1)
		self.bind("<ButtonRelease-1>",	self.release1)
		self.bind("<Double-1>",		self.double)
		self.bind("<Return>",		self.edit)
		self.bind("<KP_Enter>",		self.edit)
		self.bind("<Insert>",		self.insertItem)
		self.bind("<Control-Key-Return>",self.insertItem)
		self.bind("<Control-Key-space>",self.commandFocus)
		self.bind("<Delete>",		self.deleteLine)
		self.bind("<BackSpace>",	self.deleteLine)
		try:
			self.bind("<KP_Delete>",self.deleteLine)
		except:
			pass

		self.bind("<Control-Key-b>",	self.insertBlock)
		self.bind("<Control-Key-r>",	self.fill)

		self._blockPos = []
		self._items    = []
		self.app       = app
		self.gcode     = app.gcode
		self.font      = tkFont.nametofont(self.cget("font"))
		self._ystart   = 0
		self._double   = False	# double clicked handled
		self._hadfocus = False
开发者ID:toomuchcookies,项目名称:bCNC,代码行数:28,代码来源:CNCList.py

示例13: building_fonts

 def building_fonts(self):
     "building fonts"
     if not ON_PYTHON3:
         import tkFont
     else:
         from tkinter import font as tkFont
     self.title_font = tkFont.nametofont("TkCaptionFont")
     self.button_font = tkFont.Font(name="Helvetica", size=28)
开发者ID:luisperlaz,项目名称:curso_python_ayto_2013,代码行数:8,代码来源:pytddmon.py

示例14: zoom_in

    def zoom_in(self, event):
        """ Ctrl+= increases text size """

        font = tkFont.nametofont("CodeFont")
        size = font.actual()["size"]+2
        font.configure(size=size)

        return 'break'
开发者ID:Scinawa,项目名称:FoxDot,代码行数:8,代码来源:__init__.py

示例15: controls

    def controls(self):
        self.controlwin = Toplevel(self)
        self.controlwin.resizable(0,0)
        custom_title = Label(self.controlwin,text="Control options:",font=tkFont.nametofont("TkTextFont"))
        custom_title.grid(row=0,column=0,columnspan=3)
        #self.mouse_button = Button(self.controlwin,    text="Move mouse         ",font=self.mediumfont, command=self.toggle_move_mouse)
        #self.mouse_button.grid(row=1,column=0)
        #if defines.USE_MOUSE:
        #    self.mouse_button.configure(background="#00ff00")
        #else:
        #    self.mouse_button.configure(background="#ff0000")

        mouse_speed_label = Label(self.controlwin,text="Mouse speed:",font=tkFont.nametofont("TkTextFont"))
        mouse_speed_label.grid(row=2,column=0)
        self.mouse_speed_scale = Scale(self.controlwin, from_=1, to=9,font=tkFont.nametofont("TkTextFont"), orient=HORIZONTAL,command=self.save_mouse_speed)
        self.mouse_speed_scale.grid(row=2,column=1)
        self.mouse_speed_scale.set(defines.MOUSE_SPEED)

        start_hour_label = Label(self.controlwin,text="Hour to start:",font=tkFont.nametofont("TkTextFont"))
        start_hour_label.grid(row=3,column=0)
        self.start_hour_scale = Scale(self.controlwin, from_=0, to=24,font=tkFont.nametofont("TkTextFont"), orient=HORIZONTAL,command=self.save_start_hour)
        self.start_hour_scale.grid(row=3,column=1)
        self.start_hour_scale.set(defines.START_HOUR)
        
        stop_hour_label = Label(self.controlwin,text="Hour to stop:",font=tkFont.nametofont("TkTextFont"))
        stop_hour_label.grid(row=4,column=0)
        self.stop_hour_scale = Scale(self.controlwin, from_=0, to=24,font=tkFont.nametofont("TkTextFont"), orient=HORIZONTAL,command=self.save_stop_hour)
        self.stop_hour_scale.grid(row=4,column=1)
        self.stop_hour_scale.set(defines.STOP_HOUR)
开发者ID:schultem,项目名称:HSBOT,代码行数:29,代码来源:play.py


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