本文整理汇总了Python中tkinter.ttk.Frame.update方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.update方法的具体用法?Python Frame.update怎么用?Python Frame.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Frame
的用法示例。
在下文中一共展示了Frame.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CategoriesCheckBox
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import update [as 别名]
class CategoriesCheckBox(LabelFrame):
''' This class implement a widget for displaying and
configuring categories.
Attributes:
parent (Tk object): widget parent.
frame_with_boxes (Frame): frame for check buttons.
canvas (StyledCanvas): canvas for all objects of this widget.
options (dict of str to list of IntVar and int): dictionary
that maps
category name to two IntVar objects that keep track of the
state of check buttons and grid row index.
The first check button is used
for checking if category is non-discretionary. The second
check button is used for checking if category is weakly
disposal.
nb_entries (int): total number of categories.
add_headers (bool): if set to True, the widget displays column
headers, if set to False column headers are not
displayed.
category_objects (dict of list of Tk objects): dictionary that
maps category name to a list with three elements. The first
element is Label with category name, the remaining elements
are Checkbuttons used for non-discretionary and weakly
disposal categories.
params (Parameters): parameters of the model.
category_type (str): INPUT_CATEGORIES or OUTPUT_CATEGORIES,
defines type of categories (input or output).
Args:
parent (Tk object): widget parent.
label_text (str): text that will be displayed on top of this widget.
add_headers (bool): if set to True, the widget displays column
headers, if set to False column headers are not
displayed.
params (Parameters): parameters of the model.
category_type (str): INPUT_CATEGORIES or OUTPUT_CATEGORIES,
defines type of categories (input or output).
'''
def __init__(self, parent, label_text, add_headers, params,
category_type, *args, **kw):
LabelFrame.__init__(self, parent, text=label_text, *args, **kw)
self.parent = parent
self.frame_with_boxes = None
self.canvas = None
self.options = dict()
self.nb_entries = 0
self.add_headers = add_headers
self.category_objects = dict()
self.params = params
self.category_type = category_type
self.create_widgets()
def create_widgets(self):
''' Creates widgets of this object.
'''
yScrollbar = Scrollbar(self, orient=VERTICAL)
yScrollbar.grid(row=2, column=3, sticky=N+S)
canvas = StyledCanvas(self, height=HEIGHT_WITHOUT_CHECKBOXES,
yscrollcommand=yScrollbar.set)
self.canvas = canvas
canvas.grid(row=2, column=0, columnspan=3, sticky=N+E+W)
self._config_columns(self)
canvas.columnconfigure(0, weight=1)
if self.add_headers:
non_discr_lbl = Label(self, text='Non-\ndiscretionary')
non_discr_lbl.grid(row=0, column=1, padx=3, pady=1)
weakly_disp_lbl = Label(self, text='Weakly\ndisposable')
weakly_disp_lbl.grid(row=0, column=2, padx=3, pady=1)
sep = Separator(self)
sep.grid(row=1, column=0, columnspan=3, sticky=E+W, pady=10, padx=3)
self.frame_with_boxes = Frame(canvas)
self._config_columns(self.frame_with_boxes)
self.frame_with_boxes.grid(sticky=N+S+W+E, pady=15, padx=3)
canvas.create_window(0, 0, window=self.frame_with_boxes, anchor=N+W)
canvas.update_idletasks()
canvas['scrollregion'] = (0, 0, 0, HEIGHT_WITHOUT_CHECKBOXES)
yScrollbar['command'] = canvas.yview
MouseWheel(self).add_scrolling(canvas, yscrollbar=yScrollbar)
def add_category(self, category_name):
''' Adds a given category to this object. If the given
category already exists, it won't be added again. Category
names are assumed to be unique.
Args:
category_name (str): name of the category to add.
'''
if category_name not in self.category_objects.keys():
categories = self.params.get_set_of_parameters(self.category_type)
if category_name not in categories:
categories.add(category_name)
self.params.update_parameter(self.category_type,
#.........这里部分代码省略.........