本文整理汇总了Python中tkinter.LabelFrame方法的典型用法代码示例。如果您正苦于以下问题:Python tkinter.LabelFrame方法的具体用法?Python tkinter.LabelFrame怎么用?Python tkinter.LabelFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter
的用法示例。
在下文中一共展示了tkinter.LabelFrame方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def __init__(self, parent):
tk.LabelFrame.__init__(self, parent)
self.title = tk.Label(self, text='SV Length')
self.len_GT_On = tk.IntVar(value=0)
self.len_GT_On_CB = tk.Checkbutton(self, text=">", justify=tk.LEFT, variable=self.len_GT_On)
self.len_GT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3)
self.len_GT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)
self.len_LT_On = tk.IntVar(value=0)
self.len_LT_On_CB = tk.Checkbutton(self, text="<", justify=tk.LEFT, variable=self.len_LT_On)
self.len_LT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3)
self.len_LT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)
self.title.grid(row=0, column=0, sticky=tk.EW, columnspan=4)
self.len_GT_On_CB.grid(row=1, column=0, sticky=tk.EW)
self.len_GT_val.grid(row=2, column=0, sticky=tk.EW)
self.len_GT_Units.grid(row=2, column=1, sticky=tk.EW)
self.len_LT_On_CB.grid(row=1, column=2, sticky=tk.EW)
self.len_LT_val.grid(row=2, column=2, sticky=tk.EW)
self.len_LT_Units.grid(row=2, column=3, sticky=tk.EW)
示例2: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.chan_num != -1:
self.results_group = tk.LabelFrame(
self, text="Results", padx=3, pady=3)
self.results_group.pack(
fill=tk.X, anchor=tk.NW, padx=3, pady=3)
self.data_frame = tk.Frame(self.results_group)
self.data_frame.grid()
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
self.start_button = tk.Button(button_frame)
self.start_button["text"] = "Start"
self.start_button["command"] = self.start
self.start_button.grid(row=0, column=0, padx=3, pady=3)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例3: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def __init__(self, master):
# Initialize the Frame object.
super().__init__(master)
# Create every opening widget.
self.intro = Label(self, text=self.PROMPT)
self.group = LabelFrame(self, text='Filename')
self.entry = Entry(self.group, width=35)
self.click = Button(self.group, text='Browse ...', command=self.file)
self.enter = Button(self, text='Continue', command=self.start)
# Make Windows entry bindings.
def select_all(event):
event.widget.selection_range(0, tkinter.END)
return 'break'
self.entry.bind('<Control-Key-a>', select_all)
self.entry.bind('<Control-Key-/>', lambda event: 'break')
# Position them in this frame.
options = {'sticky': tkinter.NSEW, 'padx': 5, 'pady': 5}
self.intro.grid(row=0, column=0, **options)
self.group.grid(row=1, column=0, **options)
self.entry.grid(row=0, column=0, **options)
self.click.grid(row=0, column=1, **options)
self.enter.grid(row=2, column=0, **options)
示例4: select_layer_rb
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def select_layer_rb(self):
"""Select layer."""
if hasattr(self, 'layer_frame'):
self.layer_frame.pack_forget()
self.layer_frame.destroy()
self.layer_frame = tk.LabelFrame(self.graph_frame, labelanchor='nw',
text="Select layer", relief='raised',
borderwidth='3', bg='white')
self.layer_frame.pack(side='bottom', fill=None, expand=False)
self.plots_dir = os.path.join(self.gui_log.get(),
self.selected_plots_dir.get())
if os.path.isdir(self.plots_dir):
layer_dirs = [d for d in sorted(os.listdir(self.plots_dir))
if d != 'normalization' and
os.path.isdir(os.path.join(self.plots_dir, d))]
[tk.Radiobutton(self.layer_frame, bg='white', text=name,
value=name, command=self.display_graphs,
variable=self.layer_to_plot).pack(
fill='both', side='bottom', expand=True)
for name in layer_dirs]
示例5: create_advance
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def create_advance(self):
'''
高级菜单
'''
advance = tk.LabelFrame(self.main_frame1, text='高级选项')
advance.pack(padx=5, pady=5, fill=tk.X, side=tk.BOTTOM)
tk.Checkbutton(advance, text='调试模式',
variable=self.debug_enable).pack(anchor=tk.W)
tk.Checkbutton(advance, text='超时自动关闭阴阳师',
variable=self.watchdog_enable).pack(anchor=tk.W)
frame = tk.Frame(advance)
frame.pack(anchor=tk.W)
tk.Label(frame, text=' 画面超时时间(秒):').grid(row=0, column=0)
tk.Entry(frame, textvariable=self.max_win_time,
width=5).grid(row=0, column=1)
tk.Label(frame, text=' 操作超时时间(秒):').grid(row=1, column=0)
tk.Entry(frame, textvariable=self.max_op_time,
width=5).grid(row=1, column=1)
示例6: keyword
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def keyword(self): # 钉钉机器人
Keyword = tk.LabelFrame(self.window, text="钉钉机器人", padx=10, pady=10) # 水平,垂直方向上的边距均为10
Keyword.place(x=1070, y=100)
self.keywordListBox = Listbox(Keyword, width=35, height=8, )
self.keywordListBox.pack(side=LEFT)
keywordScroBar = Scrollbar(Keyword)
keywordScroBar.pack(side=RIGHT, fill=Y)
self.keywordListBox['yscrollcommand'] = keywordScroBar.set
keywords = self.dbconf.select_all()
for key in keywords:
keyword = key.get('webhook')
self.keywordListBox.insert(END, '机器人:{};'.format(keyword))
keywordScroBar['command'] = self.keywordListBox.yview
keywordoption = tk.LabelFrame(self.window, text="", padx=10, pady=5) # 水平,垂直方向上的边距均为 10
keywordoption.place(x=1070, y=290)
tk.Button(keywordoption, text="添加机器人", command=self.add_keyword).grid(column=0, row=1, padx=9, pady=5)
tk.Button(keywordoption, text="删除机器人", command=self.delete_keyword).grid(column=1, row=1, padx=9, pady=5)
tk.Button(keywordoption, text="测试机器人", command=self.testLogin).grid(column=2, row=1, padx=9, pady=5)
示例7: user
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def user(self): # 用户信息
User = tk.LabelFrame(self.window, text="关键字任务", padx=10, pady=5) # 水平,垂直方向上的边距均为 10
User.place(x=30, y=100)
self.userListBox = Listbox(User, width=50, height=9, )
self.userListBox.pack(side=LEFT)
userScroBar = Scrollbar(User)
userScroBar.pack(side=RIGHT, fill=Y)
self.userListBox['yscrollcommand'] = userScroBar.set
self.insert_userListbox()
userScroBar['command'] = self.userListBox.yview
# userScrotext = scrolledtext.ScrolledText(User, width=30, height=6, padx=10, pady=10, wrap=tk.WORD)
# userScrotext.grid(columnspan=2, pady=10)
Useroption = tk.LabelFrame(self.window, text="", padx=10, pady=5) # 水平,垂直方向上的边距均为 10
Useroption.place(x=30, y=300)
tk.Button(Useroption, text="添加关键字", command=self.add_user).grid(column=0, row=1, padx=57, pady=5)
tk.Button(Useroption, text="删除关键字", command=self.delete_use).grid(column=1, row=1, padx=57, pady=5)
tk.Button(Useroption, text="一键开启", command=self.all_start).grid(column=0, row=3, padx=55, pady=5)
tk.Button(Useroption, text="一键关闭", command=self.all_stop).grid(column=1, row=3, padx=55, pady=5)
self.startBtn = tk.Button(Useroption, text="单项开启", command=self.start_spider)
self.startBtn.grid(column=0, row=2, padx=55, pady=5)
self.stopBtn = tk.Button(Useroption, text="单项关闭", command=self.stop_spider)
self.stopBtn.grid(column=1, row=2, padx=55, pady=5)
示例8: create_page
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def create_page(self):
User = tk.LabelFrame(self.window, text="关键字配置", padx=10, pady=5) # 水平,垂直方向上的边距均为 10
User.place(x=50, y=80)
tk.Label(User, text="关键字:").grid(column=0, row=0, sticky='w', pady=5, padx=5) # 添加用户账号
tk.Label(User, text="最低价格:").grid(column=0, row=1, sticky='w', pady=5, padx=5) # 添加用户密码
tk.Label(User, text="最高价格:").grid(column=0, row=2, sticky='w', pady=5, padx=5) # 添加用户密码
self.userEntry = tk.Entry(User, textvariable=self.username, width=23)
self.userEntry.grid(column=1, row=0, pady=5)
self.pwdEntry = tk.Entry(User, textvariable=self.password, width=23)
self.pwdEntry.grid(column=1, row=1, pady=5)
self.maxPEntry = tk.Entry(User, textvariable=self.maxPrice, width=23)
self.maxPEntry.grid(column=1, row=2, pady=5)
tk.Button(User, text="确认添加", command=self.add_user).grid(columnspan=2, row=3, pady=5, ipadx=10)
示例9: view_init
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def view_init(self):
self.frame = tk.LabelFrame(self.browser.workframe, text=" Image ")
self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=7, pady=7)
self.figure = plt.figure(figsize=(8, 12), dpi=70)
self.ax1 = plt.subplot2grid((50,40), (0, 0), rowspan=40, colspan=40)
self.ax2 = plt.subplot2grid((50,40), (42, 0), rowspan=8, colspan=40, sharex=self.ax1)
plt.subplots_adjust(left=0.1, bottom=0.05, right=0.95, top=0.97, wspace=0.2, hspace=0.2)
self.view_plot_image()
self.canvas = FigureCanvasTkAgg(self.figure, self.frame)
if self.mpltlib3:
self.canvas.draw()
toolbar = NavigationToolbar2Tk(self.canvas, self.frame).update()
else:
self.canvas.show()
toolbar = NavigationToolbar2TkAgg(self.canvas, self.frame).update()
self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, padx=2, pady=2, expand=True)
self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=7, pady=7)
示例10: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def __init__(self):
super().__init__()
self.title("Tk themed widgets")
var = tk.StringVar()
var.set(self.greetings[0])
label_frame = ttk.LabelFrame(self, text="Choose a greeting")
for greeting in self.greetings:
radio = ttk.Radiobutton(label_frame, text=greeting,
variable=var, value=greeting)
radio.pack()
frame = ttk.Frame(self)
label = ttk.Label(frame, text="Enter your name")
entry = ttk.Entry(frame)
command = lambda: print("{}, {}!".format(var.get(), entry.get()))
button = ttk.Button(frame, text="Greet", command=command)
label.grid(row=0, column=0, padx=5, pady=5)
entry.grid(row=0, column=1, padx=5, pady=5)
button.grid(row=1, column=0, columnspan=2, pady=5)
label_frame.pack(side=tk.LEFT, padx=10, pady=10)
frame.pack(side=tk.LEFT, padx=10, pady=10)
示例11: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def __init__(self):
super().__init__()
group_1 = tk.LabelFrame(self, padx=15, pady=10,
text="Personal Information")
group_1.pack(padx=10, pady=5)
tk.Label(group_1, text="First name").grid(row=0)
tk.Label(group_1, text="Last name").grid(row=1)
tk.Entry(group_1).grid(row=0, column=1, sticky=tk.W)
tk.Entry(group_1).grid(row=1, column=1, sticky=tk.W)
group_2 = tk.LabelFrame(self, padx=15, pady=10,
text="Address")
group_2.pack(padx=10, pady=5)
tk.Label(group_2, text="Street").grid(row=0)
tk.Label(group_2, text="City").grid(row=1)
tk.Label(group_2, text="ZIP Code").grid(row=2)
tk.Entry(group_2).grid(row=0, column=1, sticky=tk.W)
tk.Entry(group_2).grid(row=1, column=1, sticky=tk.W)
tk.Entry(group_2, width=8).grid(row=2, column=1,
sticky=tk.W)
self.btn_submit = tk.Button(self, text="Submit")
self.btn_submit.pack(padx=10, pady=10, side=tk.RIGHT)
示例12: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.chosenFile = None
self.chosenFilePath = tk.StringVar()
self.pathField = tk.Entry(self, width=40, textvariable=self.chosenFilePath, state=tk.DISABLED)
self.pathField.grid(row=0, column=0, padx=10)
self.selectFile = tk.Button(self, text="Choose file...", command=self.choose_a_file)
self.selectFile.grid(row=0, column=1)
self.groupFrame = tk.LabelFrame(self, text="Params", padx=5, pady=5)
self.groupFrame.grid(row=1, column=0, columnspan=2, )
self.colorPaletteLabel = tk.Label(self.groupFrame, text = 'Color Palette')
self.colorPaletteLabel.grid(row=0, column=0 )
self.colorPalette = ttk.Combobox(self.groupFrame)
self.colorPalette['values'] = LEGO_PALETTE
self.colorPalette.current(0)
self.colorPalette.grid(row=0, column=1)
self.brickNumberScale = tk.Scale(self.groupFrame, from_=1, to=200, orient=tk.HORIZONTAL, label="Number of bricks (longer edge)", length=250)
self.brickNumberScale.set(30)
self.brickNumberScale.grid(row=1, column=0, columnspan=2, )
self.convertFile = tk.Button(text="Legofy this image!", command=self.convert_file)
self.convertFile.grid(row=2, column=0, columnspan=2)
示例13: create
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def create(self, **kwargs):
return tkinter.LabelFrame(self.root, **kwargs)
示例14: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.chan_num != -1:
info_text = tk.Label(self)
info_text["text"] = (
"Encoder scan on device " + str(self.board_num)
+ " counter channel " + str(self.chan_num))
info_text.pack(fill=tk.X, anchor=tk.NW, padx=3, pady=3)
results_group = tk.LabelFrame(self, text="Results")
results_group.pack(fill=tk.X, anchor=tk.NW, padx=3, pady=3)
self.data_label = tk.Label(results_group, justify=tk.LEFT)
self.data_label.grid(padx=3, pady=3)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
self.start_button = tk.Button(button_frame)
self.start_button["text"] = "Start"
self.start_button["command"] = self.start
self.start_button.grid(row=0, column=0, padx=3, pady=3)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
# Start the example if this module is being run
示例15: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import LabelFrame [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
positive_int_vcmd = self.register(self.validate_positive_int_entry)
board_num_label = tk.Label(main_frame)
board_num_label["text"] = "Board Number:"
board_num_label.grid(row=0, column=0, sticky=tk.W)
self.board_num_variable = StringVar()
board_num_entry = tk.Spinbox(
main_frame, from_=0, to=self.max_board_num,
textvariable=self.board_num_variable,
validate="key", validatecommand=(positive_int_vcmd, "%P"))
board_num_entry.grid(row=0, column=1, sticky=tk.W)
self.board_num_variable.trace("w", self.board_num_changed)
info_groupbox = tk.LabelFrame(self, text="Board Information")
info_groupbox.pack(fill=tk.X, anchor=tk.NW, padx=3, pady=3)
self.info_label = tk.Label(
info_groupbox, justify=tk.LEFT, wraplength=400)
self.info_label.grid()
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=0, padx=3, pady=3)
# Start the example if this module is being run