Python tkinter.BROWSE Examples

The following are 3 code examples of tkinter.BROWSE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter , or try the search function .
Example #1
Source File: dataset_frame.py    From OpenCV-Video-Label with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #2
Source File: display_analysis.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
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__) 
Example #3
Source File: gui_widgets.py    From SVPV with MIT License 4 votes vote down vote up
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)