本文整理匯總了Python中tkFont.nametofont方法的典型用法代碼示例。如果您正苦於以下問題:Python tkFont.nametofont方法的具體用法?Python tkFont.nametofont怎麽用?Python tkFont.nametofont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tkFont
的用法示例。
在下文中一共展示了tkFont.nametofont方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import tkFont [as 別名]
# 或者: from tkFont import nametofont [as 別名]
def __init__(self, master):
self.master = master
master.title("StochOPy Viewer")
master.protocol("WM_DELETE_WINDOW", self.close_window)
master.geometry("900x600")
master.minsize(900, 600)
master.maxsize(900, 600)
default_font = font.nametofont("TkDefaultFont")
default_font.configure(family = "Helvetica", size = 9)
master.option_add("*Font", default_font)
self.define_variables()
self.trace_variables()
self.init_variables()
self.menubar()
self.frame1()
self.frame2()
self.footer()
self.select_widget(self.solver_name.get())
示例2: chg_fontsize
# 需要導入模塊: import tkFont [as 別名]
# 或者: from tkFont import nametofont [as 別名]
def chg_fontsize(self):
"""change the display font size"""
sizes = [10, 13, 14]
font_types = ["TkDefaultFont", "TkTextFont", "TkFixedFont",
"TkMenuFont", "TkHeadingFont", "TkCaptionFont",
"TkSmallCaptionFont", "TkIconFont", "TkTooltipFont"]
ww = ['normal', 'bold']
if self.font_size < max(sizes):
self.font_size = min([i for i in sizes if i > self.font_size])
else:
self.font_size = sizes[0]
self.font_wheight = 0
ff = 'Helvetica' if self.font_size != min(sizes) else 'Courier'
self.font_wheight = 0 if self.font_size == min(sizes) else 1
for typ in font_types:
default_font = font.nametofont(typ)
default_font.configure(size=self.font_size,
weight=ww[self.font_wheight], family=ff)
示例3: define_style
# 需要導入模塊: import tkFont [as 別名]
# 或者: from tkFont import nametofont [as 別名]
def define_style(self):
"""Define apperance style."""
self.padx = 10
self.pady = 5
font_family = 'clearlyu devagari'
self.header_font = (font_family, '11', 'bold')
font.nametofont('TkDefaultFont').configure(family=font_family, size=11)
font.nametofont('TkMenuFont').configure(family=font_family, size=11,
weight=font.BOLD)
font.nametofont('TkTextFont').configure(family=font_family, size=11)
self.kwargs = {'fill': 'both', 'expand': True,
'padx': self.padx, 'pady': self.pady}
示例4: __init__
# 需要導入模塊: import tkFont [as 別名]
# 或者: from tkFont import nametofont [as 別名]
def __init__(self, msg, title, choices, preselect, multiple_select, callback):
self.callback = callback
self.choices = choices
self.width_in_chars = global_state.prop_font_line_length
# Initialize self.selected_choices
# This is the value that will be returned if the user clicks the close
# icon
# self.selected_choices = None
self.multiple_select = multiple_select
self.boxRoot = tk.Tk()
self.boxFont = tk_Font.nametofont("TkTextFont")
self.config_root(title)
self.set_pos(global_state.window_position) # GLOBAL POSITION
self.create_msg_widget(msg)
self.create_choicearea()
self.create_ok_button()
self.create_cancel_button()
self. create_special_buttons()
self.preselect_choice(preselect)
self.choiceboxWidget.focus_force()
# Run and stop methods ---------------------------------------
示例5: __init__
# 需要導入模塊: import tkFont [as 別名]
# 或者: from tkFont import nametofont [as 別名]
def __init__(self, msg, title, text, codebox, callback):
""" Create ui object
Parameters
----------
msg : string
text displayed in the message area (instructions...)
title : str
the window title
text: str, list or tuple
text displayed in textAres (editable)
codebox: bool
if True, don't wrap, and width is set to 80 chars
callback: function
if set, this function will be called when OK is pressed
Returns
-------
object
The ui object
"""
self.callback = callback
self.boxRoot = tk.Tk()
# self.boxFont = tk_Font.Font(
# family=global_state.PROPORTIONAL_FONT_FAMILY,
# size=global_state.PROPORTIONAL_FONT_SIZE)
wrap_text = not codebox
if wrap_text:
self.boxFont = tk_Font.nametofont("TkTextFont")
self.width_in_chars = global_state.prop_font_line_length
else:
self.boxFont = tk_Font.nametofont("TkFixedFont")
self.width_in_chars = global_state.fixw_font_line_length
# default_font.configure(size=global_state.PROPORTIONAL_FONT_SIZE)
self.configure_root(title)
self.create_msg_widget(msg)
self.create_text_area(wrap_text)
self.create_buttons_frame()
self.create_cancel_button()
self.create_ok_button()
# Run and stop methods ---------------------------------------
示例6: __init__
# 需要導入模塊: import tkFont [as 別名]
# 或者: from tkFont import nametofont [as 別名]
def __init__(self, msg, title, choices, images, default_choice, cancel_choice, callback):
""" Create ui object
Parameters
----------
msg : string
text displayed in the message area (instructions...)
title : str
the window title
choices : iterable of strings
build a button for each string in choices
images : iterable of filenames, or an iterable of iterables of filenames
displays each image
default_choice : string
one of the strings in choices to be the default selection
cancel_choice : string
if X or <esc> is pressed, it appears as if this button was pressed.
callback: function
if set, this function will be called when any button is pressed.
Returns
-------
object
The ui object
"""
self._title = title
self._msg = msg
self._choices = choices
self._default_choice = default_choice
self._cancel_choice = cancel_choice
self.callback = callback
self._choice_text = None
self._choice_rc = None
self._images = list()
self.boxRoot = tk.Tk()
# self.boxFont = tk_Font.Font(
# family=global_state.PROPORTIONAL_FONT_FAMILY,
# size=global_state.PROPORTIONAL_FONT_SIZE)
self.boxFont = tk_Font.nametofont("TkFixedFont")
self.width_in_chars = global_state.fixw_font_line_length
# default_font.configure(size=global_state.PROPORTIONAL_FONT_SIZE)
self.configure_root(title)
self.create_msg_widget(msg)
self.create_images_frame()
self.create_images(images)
self.create_buttons_frame()
self.create_buttons(choices, default_choice)