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


Python tkinter.font方法代码示例

本文整理汇总了Python中tkinter.font方法的典型用法代码示例。如果您正苦于以下问题:Python tkinter.font方法的具体用法?Python tkinter.font怎么用?Python tkinter.font使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter的用法示例。


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

示例1: _init_fonts

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def _init_fonts(self, root):
        # See: <http://www.astro.washington.edu/owen/ROTKFolklore.html>
        self._sysfont = tkinter.font.Font(font=Button()["font"])
        root.option_add("*Font", self._sysfont)

        # TWhat's our font size (default=same as sysfont)
        self._size = IntVar(root)
        self._size.set(self._sysfont.cget('size'))

        self._boldfont = tkinter.font.Font(family='helvetica', weight='bold',
                                    size=self._size.get())
        self._font = tkinter.font.Font(family='helvetica',
                                    size=self._size.get())
        if self._size.get() < 0: big = self._size.get()-2
        else: big = self._size.get()+2
        self._bigfont = tkinter.font.Font(family='helvetica', weight='bold',
                                    size=big) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:19,代码来源:rdparser_app.py

示例2: _init_canvas

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def _init_canvas(self, parent):
        self._cframe = CanvasFrame(parent, background='white',
                                   width=525, closeenough=10,
                                   border=2, relief='sunken')
        self._cframe.pack(expand=1, fill='both', side='top', pady=2)
        canvas = self._canvas = self._cframe.canvas()

        self._stackwidgets = []
        self._rtextwidgets = []
        self._titlebar = canvas.create_rectangle(0,0,0,0, fill='#c0f0f0',
                                                 outline='black')
        self._exprline = canvas.create_line(0,0,0,0, dash='.')
        self._stacktop = canvas.create_line(0,0,0,0, fill='#408080')
        size = self._size.get()+4
        self._stacklabel = TextWidget(canvas, 'Stack', color='#004040',
                                      font=self._boldfont)
        self._rtextlabel = TextWidget(canvas, 'Remaining Text',
                                      color='#004040', font=self._boldfont)
        self._cframe.add_widget(self._stacklabel)
        self._cframe.add_widget(self._rtextlabel)

    #########################################
    ##  Main draw procedure
    ######################################### 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:26,代码来源:srparser_app.py

示例3: _draw_sentence

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def _draw_sentence(self):
        """Draw the sentence string."""
        if self._chart.num_leaves() == 0: return
        c = self._sentence_canvas
        margin = ChartView._MARGIN
        y = ChartView._MARGIN

        for i, leaf in enumerate(self._chart.leaves()):
            x1 = i * self._unitsize + margin
            x2 = x1 + self._unitsize
            x = (x1+x2)/2
            tag = c.create_text(x, y, text=repr(leaf),
                                font=self._font,
                                anchor='n', justify='left')
            bbox = c.bbox(tag)
            rt=c.create_rectangle(x1+2, bbox[1]-(ChartView._LEAF_SPACING/2),
                                  x2-2, bbox[3]+(ChartView._LEAF_SPACING/2),
                                  fill='#f0f0f0', outline='#f0f0f0')
            c.tag_lower(rt) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:21,代码来源:chartparser_app.py

示例4: table

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def table(self, master, title, content, target=None, backgroundcolour="White", foregroundcolour="black", bordercolour="grey", borderwidth=1, fontstyle="DejaVuSans 18 normal"):
        # creates a table from a 2 dimensional array.  
        # master: = this represents the parent window
        # content: a 2 dimensional array containing the table contents
        # First column in the array must be the row id which is returned on a click event.  This will not be displayed in the table
        index = 0
        for i in range(len(content)): #Rows
            for j in range(len(content[i])):
                if j==0: 
                    index = content[i][j]
                else:
                    b = tk.Label(master, text=str(content[i][j]), background=backgroundcolour, foreground=foregroundcolour,padx=5, pady=10, highlightthickness=borderwidth, highlightbackground=bordercolour, font=fontstyle)
                    if (target is not None):
                        b.bind('<ButtonPress-1>', self.__row_pressed)  
                        b.bind('<ButtonRelease-1>', lambda event, arg1=index, arg2=target: self.__row_released(event, arg1, arg2))                 
                    b.grid(row=i, column=j-1, sticky=tk.N+tk.S+tk.E+tk.W)
        return 
开发者ID:briandorey,项目名称:RaspberryPiBarcodeScanner,代码行数:19,代码来源:UICommon.py

示例5: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def __init__(self, master, audio):
        super().__init__(master)
        self.buttons = []
        self.columns = 6
        self.rows = 4
        self.font = tkinter.font.Font(family="Helvetica", size=22, weight="bold")
        self.audio = audio
        keys = ["1234567890", "qwertyuiop", "asdfghjkl;", "zxcvbnm,./"]
        for y in range(self.rows):
            for x in range(self.columns):
                key = keys[y][x]
                button = tkinter.Button(self, text=str(key), height=5, width=10, padx=24, pady=20)
                button["font"] = self.font
                button.hotkey = key
                button.dk_instrument = None
                button.bind("<Button-1>", lambda x=x, y=y, button=button: self.pressed(button))
                button.grid(row=y, column=x)
                self.buttons.append(button) 
开发者ID:irmen,项目名称:synthesizer,代码行数:20,代码来源:gui.py

示例6: create_line_numbers

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def create_line_numbers(self):
        self.leftLinenumbers = Text(self.main_window, width=3, padx=5, pady=5, height=1, bg=self.lightGrayColor)
        self.leftLinenumbers.grid(row=self.lineNumbersRow, column=self.leftLineNumbersCol, sticky=NS)
        self.leftLinenumbers.config(font=self.text_area_font)
        self.leftLinenumbers.tag_configure('line', justify='right')

        self.rightLinenumbers = Text(self.main_window, width=3, padx=5, pady=5, height=1, bg=self.lightGrayColor)
        self.rightLinenumbers.grid(row=self.lineNumbersRow, column=self.rightLineNumbersCol, sticky=NS)
        self.rightLinenumbers.config(font=self.text_area_font)
        self.rightLinenumbers.tag_configure('line', justify='right')

        # disable the line numbers
        self.leftLinenumbers.config(state=DISABLED)
        self.rightLinenumbers.config(state=DISABLED)

    # Scroll bars 
开发者ID:yebrahim,项目名称:pydiff,代码行数:18,代码来源:mainwindow_ui.py

示例7: drawGrid

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def drawGrid(self, clearGrid = False):
		font = tkFont.Font(family=zynthian_gui_config.font_topbar[0], size=self.fontsize)
		if clearGrid:
			self.gridCanvas.delete(tkinter.ALL)
			self.columnWidth = self.gridWidth / self.horizontalZoom
			self.trackTitleCanvas.delete("trackname")
		self.playCanvas.delete("timetext")
		# Draw cells of grid
		self.gridCanvas.itemconfig("gridcell", fill=CELL_BACKGROUND)
		for row in range(self.verticalZoom):
			if row >= len(self.tracks):
				break
			if clearGrid:
				self.trackTitleCanvas.create_text((0, self.rowHeight * (row + 0.5)), text="Track %d" % (self.tracks[row]), font=font, fill=CELL_FOREGROUND, tags=("rowtitle%d" % (row),"trackname"), anchor="w")
				self.gridCanvas.create_text(self.gridWidth - self.selectThickness, self.rowHeight * (self.rowHeight * int(row + 0.5)), state="hidden", tags=("lastpatterntext%d" % (row), "lastpatterntext"), font=font, anchor="e")
			self.drawRow(row)
		self.playCanvas.create_text(0 * self.columnWidth, PLAYHEAD_HEIGHT / 2, text="%d"%(self.colOffset), tags=("timetext"), anchor="w", fill=CELL_FOREGROUND)

		if clearGrid:
			for clock in range(self.horizontalZoom):
				self.gridCanvas.tag_lower("clock%d"%clock)

	# Function to update selectedCell
	#	clock: Clock (column) of selected cell (Optional - default to reselect current column)
	#	track: Track number of selected cell (Optional - default to reselect current =row) 
开发者ID:zynthian,项目名称:zynthian-ui,代码行数:27,代码来源:zynthian_gui_songeditor.py

示例8: choosepic

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def choosepic():
	global Flag
	path_=askopenfilename()
	path.set(path_)
	global img_open
	img_open = Image.open(e1.get()).convert('L')
	img=ImageTk.PhotoImage(img_open)
	l1.config(image=img)
	l1.image=img #keep a reference
	var = tkinter.StringVar()
	var.set('                                                                               ')
	e2=Label(root,textvariable = var, font = ('Arial', 25))
	e2.place(relx=0.05,y=500)
	e3=Label(root,textvariable = var, font = ('Arial', 25))
	e3.place(relx=0.55,y=500)
	Flag = False 
开发者ID:whywhs,项目名称:Pytorch-Handwritten-Mathematical-Expression-Recognition,代码行数:18,代码来源:finalTK.py

示例9: _init_fonts

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def _init_fonts(self, top):
        # TWhat's our font size (default=same as sysfont)
        self._size = IntVar(top)
        self._size.set(20)
        self._font = tkinter.font.Font(family='helvetica',
                                 size=-self._size.get())
        self._smallfont = tkinter.font.Font(family='helvetica',
                                      size=-(int(self._size.get()*14/20))) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:10,代码来源:chunkparser_app.py

示例10: _init_grammar

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def _init_grammar(self, parent):
        # Grammar view.
        self._prodframe = listframe = Frame(parent)
        self._prodframe.pack(fill='both', side='left', padx=2)
        self._prodlist_label = Label(self._prodframe, font=self._boldfont,
                                     text='Available Expansions')
        self._prodlist_label.pack()
        self._prodlist = Listbox(self._prodframe, selectmode='single',
                                 relief='groove', background='white',
                                 foreground='#909090', font=self._font,
                                 selectforeground='#004040',
                                 selectbackground='#c0f0c0')

        self._prodlist.pack(side='right', fill='both', expand=1)

        self._productions = list(self._parser.grammar().productions())
        for production in self._productions:
            self._prodlist.insert('end', ('  %s' % production))
        self._prodlist.config(height=min(len(self._productions), 25))

        # Add a scrollbar if there are more than 25 productions.
        if len(self._productions) > 25:
            listscroll = Scrollbar(self._prodframe,
                                   orient='vertical')
            self._prodlist.config(yscrollcommand = listscroll.set)
            listscroll.config(command=self._prodlist.yview)
            listscroll.pack(side='left', fill='y')

        # If they select a production, apply it.
        self._prodlist.bind('<<ListboxSelect>>', self._prodlist_select) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:32,代码来源:rdparser_app.py

示例11: _init_feedback

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def _init_feedback(self, parent):
        self._feedbackframe = feedbackframe = Frame(parent)
        feedbackframe.pack(fill='x', side='bottom', padx=3, pady=3)
        self._lastoper_label = Label(feedbackframe, text='Last Operation:',
                                     font=self._font)
        self._lastoper_label.pack(side='left')
        lastoperframe = Frame(feedbackframe, relief='sunken', border=1)
        lastoperframe.pack(fill='x', side='right', expand=1, padx=5)
        self._lastoper1 = Label(lastoperframe, foreground='#007070',
                                background='#f0f0f0', font=self._font)
        self._lastoper2 = Label(lastoperframe, anchor='w', width=30,
                                foreground='#004040', background='#f0f0f0',
                                font=self._font)
        self._lastoper1.pack(side='left')
        self._lastoper2.pack(side='left', fill='x', expand=1) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:17,代码来源:rdparser_app.py

示例12: _redraw

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def _redraw(self):
        canvas = self._canvas

        # Delete the old tree, widgets, etc.
        if self._tree is not None:
            self._cframe.destroy_widget(self._tree)
        for twidget in self._textwidgets:
            self._cframe.destroy_widget(twidget)
        if self._textline is not None:
            self._canvas.delete(self._textline)

        # Draw the tree.
        helv = ('helvetica', -self._size.get())
        bold = ('helvetica', -self._size.get(), 'bold')
        attribs = {'tree_color': '#000000', 'tree_width': 2,
                   'node_font': bold, 'leaf_font': helv,}
        tree = self._parser.tree()
        self._tree = tree_to_treesegment(canvas, tree, **attribs)
        self._cframe.add_widget(self._tree, 30, 5)

        # Draw the text.
        helv = ('helvetica', -self._size.get())
        bottom = y = self._cframe.scrollregion()[3]
        self._textwidgets = [TextWidget(canvas, word, font=self._font)
                             for word in self._sent]
        for twidget in self._textwidgets:
            self._cframe.add_widget(twidget, 0, 0)
            twidget.move(0, bottom-twidget.bbox()[3]-5)
            y = min(y, twidget.bbox()[1])

        # Draw a line over the text, to separate it from the tree.
        self._textline = canvas.create_line(-5000, y-5, 5000, y-5, dash='.')

        # Highlight appropriate nodes.
        self._highlight_nodes()
        self._highlight_prodlist()

        # Make sure the text lines up.
        self._position_text() 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:41,代码来源:rdparser_app.py

示例13: help

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def help(self, *e):
        self._autostep = 0
        # The default font's not very legible; try using 'fixed' instead.
        try:
            ShowText(self._top, 'Help: Recursive Descent Parser Application',
                     (__doc__ or '').strip(), width=75, font='fixed')
        except:
            ShowText(self._top, 'Help: Recursive Descent Parser Application',
                     (__doc__ or '').strip(), width=75) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:11,代码来源:rdparser_app.py

示例14: _init_fonts

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def _init_fonts(self, root):
        # See: <http://www.astro.washington.edu/owen/ROTKFolklore.html>
        self._sysfont = tkinter.font.Font(font=Button()["font"])
        root.option_add("*Font", self._sysfont)

        # TWhat's our font size (default=same as sysfont)
        self._size = IntVar(root)
        self._size.set(self._sysfont.cget('size'))

        self._boldfont = tkinter.font.Font(family='helvetica', weight='bold',
                                    size=self._size.get())
        self._font = tkinter.font.Font(family='helvetica',
                                    size=self._size.get()) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:15,代码来源:srparser_app.py

示例15: _init_grammar

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import font [as 别名]
def _init_grammar(self, parent):
        # Grammar view.
        self._prodframe = listframe = Frame(parent)
        self._prodframe.pack(fill='both', side='left', padx=2)
        self._prodlist_label = Label(self._prodframe,
                                     font=self._boldfont,
                                     text='Available Reductions')
        self._prodlist_label.pack()
        self._prodlist = Listbox(self._prodframe, selectmode='single',
                                 relief='groove', background='white',
                                 foreground='#909090',
                                 font=self._font,
                                 selectforeground='#004040',
                                 selectbackground='#c0f0c0')

        self._prodlist.pack(side='right', fill='both', expand=1)

        self._productions = list(self._parser.grammar().productions())
        for production in self._productions:
            self._prodlist.insert('end', (' %s' % production))
        self._prodlist.config(height=min(len(self._productions), 25))

        # Add a scrollbar if there are more than 25 productions.
        if 1:#len(self._productions) > 25:
            listscroll = Scrollbar(self._prodframe,
                                   orient='vertical')
            self._prodlist.config(yscrollcommand = listscroll.set)
            listscroll.config(command=self._prodlist.yview)
            listscroll.pack(side='left', fill='y')

        # If they select a production, apply it.
        self._prodlist.bind('<<ListboxSelect>>', self._prodlist_select)

        # When they hover over a production, highlight it.
        self._hover = -1
        self._prodlist.bind('<Motion>', self._highlight_hover)
        self._prodlist.bind('<Leave>', self._clear_hover) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:39,代码来源:srparser_app.py


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