本文整理汇总了Python中Tkinter.Frame.update_idletasks方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.update_idletasks方法的具体用法?Python Frame.update_idletasks怎么用?Python Frame.update_idletasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Frame
的用法示例。
在下文中一共展示了Frame.update_idletasks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_label
# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import update_idletasks [as 别名]
def new_label(self):
# Creating a new row header
self._number_of_labels += 1
frame_button = Frame(self._frame_of_row_numbers, height=self._row_height)
frame_button.pack()
frame_button.pack_propagate(False)
row_label = Label(frame_button, text =self._number_of_labels, **self._labelrow_kwargs)
row_label.bind("<1>", lambda event, index=self._number_of_labels-1: self._on_click_label(index))
if self._hover_background:
row_label.bind("<Enter>", lambda event, row_label=row_label: row_label.configure(background=self._hover_background))
row_label.bind("<Leave>", lambda event, row_label=row_label: row_label.configure(background=self.cget("background")))
row_label.pack(expand=True, fill=BOTH)
width_of_row_numbers= max(row_label.winfo_reqwidth(), self._row_minwidth)
if width_of_row_numbers > self._width_of_row_numbers:
self._width_of_row_numbers = width_of_row_numbers
for slave in self._frame_of_row_numbers.pack_slaves():
slave.configure(width=width_of_row_numbers)
else:
frame_button.configure(width=width_of_row_numbers)
frame_button.update_idletasks()
self.config(width=self._frame_of_row_numbers.winfo_reqwidth())
self.config(scrollregion=(0, 0, self._frame_of_row_numbers.winfo_reqwidth(), self._number_of_labels*self._row_height))
示例2: createWidgets
# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import update_idletasks [as 别名]
def createWidgets(self):
if self.widgets:
for label in self.widgets:
label.update()
else:
labels =[]
f = Frame(self.canv)
f.rowconfigure(0, weight=1)
f.columnconfigure(0, weight=1)
for slot in self.device.storage_slots:
label = StorageLabel(f,slot)
labels.append(label)
self.canv.create_window(0, 0, anchor='nw', window=f)
f.update_idletasks()
self.canv.config(scrollregion=self.canv.bbox("all"))
self.widgets = labels