本文整理汇总了Python中tkinter.BROWSE属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.BROWSE属性的具体用法?Python tkinter.BROWSE怎么用?Python tkinter.BROWSE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.BROWSE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import BROWSE [as 别名]
def __init__(self, parent, header, width=10, selectmode=tk.BROWSE):
tk.Frame.__init__(self, parent)
self.parent = parent
self.num_f = len(header)
self.headers = []
self.lbs = []
self.c = 0
self.sel_idxs = []
self.scroll = tk.Scrollbar(self, orient=tk.VERTICAL)
for i in range(0, self.num_f):
self.headers.append(tk.Label(self, text=header[i]))
self.headers[-1].grid(row=0, column=self.c, sticky=tk.EW)
self.lbs.append(tk.Listbox(self, width=width, selectmode=selectmode, yscrollcommand=self.yscroll, bg='white'))
self.lbs[-1].grid(row=1, column=self.c, sticky=tk.EW)
self.lbs[-1].bind("<<ListboxSelect>>", self.select)
self.c += 1
self.scroll.config(command=self.lbs[0].yview)
self.scroll.grid(row=1, column=self.c, sticky=tk.NS)
示例2: reset_frames
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import BROWSE [as 别名]
def reset_frames(self, update_current_class=True):
self.dataset = self.parent.dataset
self.clear(self.frame_list)
self.canvas.yview_moveto(0)
# if tab switching or image has been deleted and class is now empty
if update_current_class or self.current_class not in self.dataset.classes:
self.current_class = self.parent.current_object
# initialise delete button if not yet done
if not self.delete_button and self.current_class:
self.delete_button = tk.Button(self.settings_frame, EDIT_BUTTON_LAYOUT, text='Delete selected images',
command=self.delete_selected)
self.delete_button.pack(side="top", fill="x", pady=10, padx=20)
self.export_button = tk.Button(self.settings_frame, EDIT_BUTTON_LAYOUT, text='Export dataset',
command=self.export_dataset_thread)
self.export_button.pack(side="bottom", fill="x", pady=10, padx=40)
spacing = tk.Frame(self.settings_frame, bg=GUI_SHADOW, height=1)
spacing.pack(side="bottom", fill="x", padx=10)
self.export_selection = tk.Listbox(self.settings_frame, selectmode=tk.BROWSE)
self.export_selection.configure(relief="flat", cursor="hand2", takefocus=0, activestyle='none', bd=0,
height=3,
highlightcolor=GUI_BG, highlightbackground=GUI_BG,
font=("Arial", 11, "bold"),
selectbackground=GUI_SHADOW, fg=GUI_GRAYD, listvariable=0,
selectforeground=GUI_GRAYD,
exportselection=False)
self.export_selection.bind('<<ListboxSelect>>', self.update_export_selection)
self.export_selection.insert(0, " Cropped images")
self.export_selection.insert(1, " Pascal VOC (xml)")
self.export_selection.insert(2, " Single csv file")
self.export_selection.select_set(0)
self.export_selection.pack(side="bottom", fill="x", pady=5, padx=40)
# option menu to select how the data will be exported:
tk.Label(self.settings_frame, bg=GUI_BG, fg=GUI_GRAYD, font="Arial 10 bold",
text="Export format:").pack(side="bottom", fill="x", padx=40)
示例3: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import BROWSE [as 别名]
def __init__(self, parent, selected_id, helptext):
logger.debug("Initializing: %s: (parent, %s, selected_id: %s, helptext: '%s')",
self.__class__.__name__, parent, selected_id, helptext)
super().__init__(parent)
self.pack(side=tk.TOP, padx=5, pady=5, fill=tk.BOTH, expand=True)
self.session = None # set when loading or clearing from parent
self.thread = None # Thread for loading data popup
self.selected_id = selected_id
self.popup_positions = list()
self.canvas = tk.Canvas(self, bd=0, highlightthickness=0)
self.canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
self.tree_frame = ttk.Frame(self.canvas)
self.tree_canvas = self.canvas.create_window((0, 0), window=self.tree_frame, anchor=tk.NW)
self.sub_frame = ttk.Frame(self.tree_frame)
self.sub_frame.pack(side=tk.LEFT, fill=tk.X, anchor=tk.N, expand=True)
self.add_label()
self.tree = ttk.Treeview(self.sub_frame, height=1, selectmode=tk.BROWSE)
self.scrollbar = ttk.Scrollbar(self.tree_frame, orient="vertical", command=self.tree.yview)
self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
self.columns = self.tree_configure(helptext)
self.canvas.bind("<Configure>", self.resize_frame)
logger.debug("Initialized: %s", self.__class__.__name__)