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

Python tkFont.nametofont函数代码示例

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

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



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


示例16: create_res_window

    def create_res_window(self, results, table_name):
        """Creates a window to navigate and select item results of query.
        As side effect, uses set_selection function to resolve selection events.

        :param results: the results to display
        :param table_name: the name of the table being queried
        :return: None
        """

        self.results = results

        def to_string(item):
            """Returns an appropriate string reps for results display.

            :param item: item to represent
            :return: formatted string
            """
            the_string = ''
            for i in [1, 2, 3, 4, 8, 6]:
                if i == 6:
                    the_string += "$" + "%.2f" % item[i] + '   '
                elif i == 2:
                    if table_name == 'Tie':
                        the_string += str(item[i]) + '"' + '   '
                    else:
                        the_string += str(item[i]) + '   '
                elif i == 8:
                    the_string += item[i] + " (" + item[10] + ", " + item[11] + ")   "
                else:
                    the_string += item[i] + '   '
            return the_string

        # setup toplevel display
        self.scroll_window = Toplevel(self.frame)
        self.scroll_window.geometry("%dx%d%+d%+d" % (500, 200, self.frame.winfo_rootx()+10, self.frame.winfo_rooty()))

        inner_window = Frame(self.scroll_window)
        inner_window.pack(fill=BOTH)

        # setup horizontal and vertical scrollbars
        scrollbar = Scrollbar(inner_window, orient=VERTICAL)
        xscrollbar = Scrollbar(inner_window, orient=HORIZONTAL)
        self.select_list = Listbox(inner_window, yscrollcommand=scrollbar.set, xscrollcommand=xscrollbar.set,
                                   font=tkFont.nametofont('TkFixedFont'))
        scrollbar.config( command = self.select_list.yview)
        scrollbar.pack(side=RIGHT, fill=Y)
        xscrollbar.config( command = self.select_list.xview)
        xscrollbar.pack(side=BOTTOM, fill=X)

        # insert string reps of result items
        for item in results:
            self.select_list.insert(END, to_string(item))
        self.select_list.pack(side=LEFT, fill=BOTH, expand=1)

        #currently destroy window... need to return/set selection
        Button(self.scroll_window, text="Select", command=self.set_selection).pack(side=LEFT, expand=1)
        Button(self.scroll_window, text="Cancel", command=lambda: self.set_selection(True)).pack(side=RIGHT, expand=1)
开发者ID:jrbostic,项目名称:SnootbootApp,代码行数:57,代码来源:snootboot_gui.py


示例17: createLabel

    def createLabel(self, text, row):
        paddingLeft = WINDOW_BORDER
        paddingTop = WINDOW_BORDER if (row == 0) else 0

        labelFont = tkFont.nametofont("TkDefaultFont")

        text = text + ":"
        label = Tkinter.Label(self, anchor="e", fg="black", text=text, width=WINDOW_LABEL_WIDTH, font=labelFont)
        label.grid(
            column=0, row=row, sticky="NE", padx=(paddingLeft, WINDOW_SPACING), pady=(paddingTop, WINDOW_SPACING)
        )
开发者ID:Shivon,项目名称:Pacman_Reinforcement,代码行数:11,代码来源:runtimeSettings.py


示例18: set_font

def set_font(root, size):
    """TODO: Docstring for set_font.

    :root: TODO
    :size: TODO
    :returns: TODO

    """
    default_font = tkFont.nametofont('TkDefaultFont')
    default_font.configure(size=size)
    root.option_add('*Font', default_font)
开发者ID:krzwolk,项目名称:GroundHog,代码行数:11,代码来源:__init__.py


示例19: __init__

    def __init__(self, *args, **kwargs):
        tk.Label.__init__(self, *args, **kwargs)

        # clone the font, so we can dynamically change
        # it to fit the label width
        font = self.cget("font")
        base_font = tkFont.nametofont(self.cget("font"))
        self.font = tkFont.Font()
        self.font.configure(**base_font.configure())
        self.configure(font=self.font)

        self.bind("<Configure>", self._on_configure)
开发者ID:JonnyCBB,项目名称:RADDOSE-3D_GUI,代码行数:12,代码来源:customMadeWidgets.py


示例20: createSpace

 def createSpace(self, row):
     paddingLeft = WINDOW_BORDER
     paddingTop = WINDOW_BORDER if (row == 0) else 0
     
     labelFont = tkFont.nametofont("TkDefaultFont")
     labelFont = labelFont.copy()
     labelFont.config(weight='bold')
     
     text = ""
     label = Tkinter.Label(self,
         anchor="e", fg="black", text=text, width=WINDOW_LABEL_WIDTH, font=labelFont)
     label.grid(column=0, row=row, sticky='NE',
         padx=(paddingLeft, WINDOW_SPACING), pady=(paddingTop, WINDOW_SPACING))
开发者ID:ChristianZen,项目名称:proLA_pacman,代码行数:13,代码来源:statistics.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tkMessageBox.askokcancel函数代码示例发布时间:2022-05-27
下一篇:
Python tkFileDialog.asksaveasfilename函数代码示例发布时间: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