本文整理汇总了Python中ttk.LabelFrame方法的典型用法代码示例。如果您正苦于以下问题:Python ttk.LabelFrame方法的具体用法?Python ttk.LabelFrame怎么用?Python ttk.LabelFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk
的用法示例。
在下文中一共展示了ttk.LabelFrame方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: preferences
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import LabelFrame [as 别名]
def preferences(self, event=None):
preferenceTop = tkinter.Toplevel()
preferenceTop.focus_set()
notebook = ttk.Notebook(preferenceTop)
frame1 = ttk.Frame(notebook)
notebook.add(frame1, text='general')
frame2 = ttk.Frame(notebook)
notebook.add(frame2, text='shortcuts')
c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word)
c.pack()
shortcuts_vars = []
shortcuts_gui = []
cur_row = 0
j = -1
frame_list = []
frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts"))
frame_list[-1].pack(fill="both", expand="yes")
for i, shortcut in enumerate(self.shortcuts):
j += 1
key, cmd, bindings = shortcut
name, command = cmd
shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key))
tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W)
entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j])
entry.grid(row=cur_row, column=1)
cur_row += 1
notebook.pack()
#
# ? menu methods
#
示例2: create
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import LabelFrame [as 别名]
def create(self, **kwargs):
return ttk.LabelFrame(self.root, **kwargs)
示例3: frame1
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import LabelFrame [as 别名]
def frame1(self):
self.frame1 = ttk.LabelFrame(self.master, text = "Parameters", borderwidth = 2, relief = "groove")
self.frame1.place(bordermode = "outside", relwidth = 0.99, relheight = 0.21, relx = 0, x = 5, y = 5, anchor = "nw")
self.frame1.first_run = True
# function
function_label = ttk.Label(self.frame1, text = "Function")
function_option_menu = ttk.OptionMenu(self.frame1, self.function, self.function.get(),
*sorted(self.FUNCOPT))
# max_iter
max_iter_label = ttk.Label(self.frame1, text = "Maximum number of iterations")
max_iter_spinbox = Spinbox(self.frame1, from_ = 2, to_ = 9999,
increment = 1, textvariable = self.max_iter,
width = 6, justify = "right", takefocus = True)
# fps
fps_label = ttk.Label(self.frame1, text = "Delay between frames (ms)")
fps_spinbox = Spinbox(self.frame1, from_ = 1, to_ = 1000,
increment = 1, textvariable = self.interval,
width = 6, justify = "right", takefocus = True)
# seed
seed_button = ttk.Checkbutton(self.frame1, text = "Fix seed",
variable = self.fix_seed, takefocus = False)
seed_spinbox = Spinbox(self.frame1, from_ = 0, to_ = self.MAX_SEED,
increment = 1, textvariable = self.seed,
width = 6, justify = "right", takefocus = True)
# solver
solver_label = ttk.Label(self.frame1, text = "Solver")
solver_option_menu = ttk.OptionMenu(self.frame1, self.solver_name, self.solver_name.get(),
*(self.EAOPT + self.MCOPT), command = self.select_widget)
# constrain
constrain_button = ttk.Checkbutton(self.frame1, text = "Constrain",
variable = self.constrain, takefocus = False)
# Layout
function_label.place(relx = 0., x = 5, y = 5, anchor = "nw")
function_option_menu.place(relx = 0., x = 75, y = 3, anchor = "nw")
max_iter_label.place(relx = 0., x = 5, y = 30, anchor = "nw")
max_iter_spinbox.place(width = 80, relx = 0., x = 220, y = 30, anchor = "nw")
fps_label.place(relx = 0., x = 5, y = 55, anchor = "nw")
fps_spinbox.place(width = 80, relx = 0., x = 220, y = 55, anchor = "nw")
seed_button.place(relx = 0., x = 5, y = 80, anchor = "nw")
seed_spinbox.place(width = 80, relx = 0., x = 220, y = 80, anchor = "nw")
solver_label.place(relx = 0.35, x = 0, y = 5, anchor = "nw")
solver_option_menu.place(relx = 0.35, x = 50, y = 3, anchor = "nw")
constrain_button.place(relx = 0.35, x = 0, y = 80, anchor = "nw")
示例4: _create_widgets
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import LabelFrame [as 别名]
def _create_widgets(self):
# storage for widgets so we don't pollute GUI app instance namespace
widget_space = collections.namedtuple('WidgetSpace', [
'button_text',
'button',
'label_frame',
'label_text',
'label',
'progress_bar',
'status_label_text',
'status_label'
])
button_text = tk.StringVar(value='Start')
button = ttk.Button(self, textvariable=button_text, command=self._start)
button.pack()
label_frame = ttk.LabelFrame(self, text='Service:Region')
label_frame.pack(fill='x')
label_text = tk.StringVar()
label = ttk.Label(label_frame, anchor='w', textvariable=label_text)
label.pack(fill='x')
#XXX: add small fraction to max so progress bar doesn't wrap when work finishes
progress_bar = ttk.Progressbar(
self,
orient='horizontal',
length=self.master.winfo_screenwidth()/5,
mode='determinate',
maximum=self.work_count+1e-10
)
progress_bar.pack(fill='both')
status_label_text = tk.StringVar(value='0 / {}'.format(self.work_count))
status_label = ttk.Label(self, anchor='w', textvariable=status_label_text)
status_label.pack(fill='x')
return widget_space(button_text,
button,
label_frame,
label_text,
label,
progress_bar,
status_label_text,
status_label)