def create_widgets(self):
    toplevel_frame = ttk.Frame(self, padding='0.1i')
    overall_frame = ttk.Frame(self, padding='0.1i')
    overall_frame.grid(row=0, column=1, sticky=tk.NSEW)
    toplevel_frame.grid(row=0, column=0, sticky=tk.NSEW)
    self.toolbox_list = self.get_toolboxes()
    self.sort_toolboxes()
    self.tools_and_toolboxes = wbt.toolbox('')
    self.sort_tools_by_toolbox()
    self.get_tools_list()
    self.tool_icon = tk.PhotoImage(file=(self.script_dir + '//img//tool.gif'))
    self.open_toolbox_icon = tk.PhotoImage(file=(self.script_dir + '//img//open.gif'))
    self.closed_toolbox_icon = tk.PhotoImage(file=(self.script_dir + '//img//closed.gif'))
    self.tools_frame = ttk.LabelFrame(toplevel_frame, text='{} Available Tools'.format(len(self.tools_list)), padding='0.1i')
    self.tool_tree = ttk.Treeview(self.tools_frame, height=21)
    self.tool_tree.grid(row=0, column=0, sticky=tk.NSEW)
    self.tool_tree.column('#0', width=280)
    self.tools_frame.grid(row=0, column=0, sticky=tk.NSEW)
    self.tools_frame.columnconfigure(0, weight=10)
    self.tools_frame.columnconfigure(1, weight=1)
    self.tools_frame.rowconfigure(0, weight=10)
    self.tools_frame.rowconfigure(1, weight=1)
    index = 0
    for toolbox in self.lower_toolboxes:
        if (toolbox.find('/') != (- 1)):
            self.tool_tree.insert(toolbox[:toolbox.find('/')], 0, text=('  ' + toolbox[(toolbox.find('/') + 1):]), iid=toolbox[(toolbox.find('/') + 1):], tags='toolbox', image=self.closed_toolbox_icon)
            for tool in self.sorted_tools[index]:
                self.tool_tree.insert(toolbox[(toolbox.find('/') + 1):], 'end', text=('  ' + tool), tags='tool', iid=tool, image=self.tool_icon)
        else:
            self.tool_tree.insert('', 'end', text=('  ' + toolbox), iid=toolbox, tags='toolbox', image=self.closed_toolbox_icon)
            for tool in self.sorted_tools[index]:
                self.tool_tree.insert(toolbox, 'end', text=('  ' + tool), iid=tool, tags='tool', image=self.tool_icon)
        index = (index + 1)
    self.tool_tree.tag_bind('tool', '<<TreeviewSelect>>', self.tree_update_tool_help)
    self.tool_tree.tag_bind('toolbox', '<<TreeviewSelect>>', self.update_toolbox_icon)
    s = ttk.Scrollbar(self.tools_frame, orient=tk.VERTICAL, command=self.tool_tree.yview)
    s.grid(row=0, column=1, sticky=(tk.N, tk.S))
    self.tool_tree['yscrollcommand'] = s.set
    self.search_list = []
    self.search_text = tk.StringVar()
    self.search_frame = ttk.LabelFrame(toplevel_frame, padding='0.1i', text='{} Tools Found'.format(len(self.search_list)))
    self.search_label = ttk.Label(self.search_frame, text='Search: ')
    self.search_bar = ttk.Entry(self.search_frame, width=30, textvariable=self.search_text)
    self.search_results_listbox = tk.Listbox(self.search_frame, height=11)
    self.search_scroll = ttk.Scrollbar(self.search_frame, orient=tk.VERTICAL, command=self.search_results_listbox.yview)
    self.search_results_listbox['yscrollcommand'] = self.search_scroll.set
    self.search_results_listbox.bind('<<ListboxSelect>>', self.search_update_tool_help)
    self.search_bar.bind('<Return>', self.update_search)
    self.search_frame.grid(row=1, column=0, sticky=tk.NSEW)
    self.search_label.grid(row=0, column=0, sticky=tk.NW)
    self.search_bar.grid(row=0, column=1, sticky=tk.NE)
    self.search_results_listbox.grid(row=1, column=0, columnspan=2, sticky=tk.NSEW, pady=5)
    self.search_scroll.grid(row=1, column=2, sticky=(tk.N, tk.S))
    self.search_frame.columnconfigure(0, weight=1)
    self.search_frame.columnconfigure(1, weight=10)
    self.search_frame.columnconfigure(1, weight=1)
    self.search_frame.rowconfigure(0, weight=1)
    self.search_frame.rowconfigure(1, weight=10)
    self.current_tool_frame = ttk.Frame(overall_frame, padding='0.01i')
    self.current_tool_lbl = ttk.Label(self.current_tool_frame, text='Current Tool: {}'.format(self.tool_name), justify=tk.LEFT)
    self.view_code_button = ttk.Button(self.current_tool_frame, text='View Code', width=12, command=self.view_code)
    self.view_code_button.grid(row=0, column=1, sticky=tk.E)
    self.current_tool_lbl.grid(row=0, column=0, sticky=tk.W)
    self.current_tool_frame.grid(row=0, column=0, columnspan=2, sticky=tk.NSEW)
    self.current_tool_frame.columnconfigure(0, weight=1)
    self.current_tool_frame.columnconfigure(1, weight=1)
    self.arg_scroll_frame = ttk.Frame(overall_frame, padding='0.0i')
    self.arg_scroll_frame.grid(row=1, column=0, sticky=tk.NSEW)
    self.arg_scroll_frame.columnconfigure(0, weight=1)
    buttons_frame = ttk.Frame(overall_frame, padding='0.1i')
    self.run_button = ttk.Button(buttons_frame, text='Run', width=8, command=self.run_tool)
    self.quit_button = ttk.Button(buttons_frame, text='Cancel', width=8, command=self.cancel_operation)
    self.help_button = ttk.Button(buttons_frame, text='Help', width=8, command=self.tool_help_button)
    self.run_button.grid(row=0, column=0)
    self.quit_button.grid(row=0, column=1)
    self.help_button.grid(row=0, column=2)
    buttons_frame.grid(row=2, column=0, columnspan=2, sticky=tk.E)
    output_frame = ttk.Frame(overall_frame)
    outlabel = ttk.Label(output_frame, text='Output:', justify=tk.LEFT)
    self.out_text = ScrolledText(output_frame, width=63, height=15, wrap=tk.NONE, padx=7, pady=7, exportselection=0)
    output_scrollbar = ttk.Scrollbar(output_frame, orient=tk.HORIZONTAL, command=self.out_text.xview)
    self.out_text['xscrollcommand'] = output_scrollbar.set
    k = wbt.tool_help(self.tool_name)
    self.out_text.insert(tk.END, k)
    outlabel.grid(row=0, column=0, sticky=tk.NW)
    self.out_text.grid(row=1, column=0, sticky=tk.NSEW)
    output_frame.grid(row=3, column=0, columnspan=2, sticky=(tk.NS, tk.E))
    output_scrollbar.grid(row=2, column=0, sticky=(tk.W, tk.E))
    self.out_text.columnconfigure(0, weight=1)
    output_frame.columnconfigure(0, weight=1)
    if (_platform == 'darwin'):
        self.out_text.bind('<Command-Key-a>', self.select_all)
    else:
        self.out_text.bind('<Control-Key-a>', self.select_all)
    progress_frame = ttk.Frame(overall_frame, padding='0.1i')
    self.progress_label = ttk.Label(progress_frame, text='Progress:', justify=tk.LEFT)
    self.progress_var = tk.DoubleVar()
    self.progress = ttk.Progressbar(progress_frame, orient='horizontal', variable=self.progress_var, length=200, maximum=100)
    self.progress_label.grid(row=0, column=0, sticky=tk.E, padx=5)
    self.progress.grid(row=0, column=1, sticky=tk.E)
    progress_frame.grid(row=4, column=0, columnspan=2, sticky=tk.SE)
    self.tool_tree.focus(self.tool_name)
    self.tool_tree.selection_set(self.tool_name)
    self.tool_tree.event_generate('<<TreeviewSelect>>')
    menubar = tk.Menu(self)
    self.filemenu = tk.Menu(menubar, tearoff=0)
    self.filemenu.add_command(label='Set Working Directory', command=self.set_directory)
    self.filemenu.add_command(label='Locate WhiteboxTools exe', command=self.select_exe)
    self.filemenu.add_command(label='Refresh Tools', command=self.refresh_tools)
    wbt.set_compress_rasters(True)
    self.filemenu.add_command(label='Do Not Compress Output TIFFs', command=self.update_compress)
    self.filemenu.add_separator()
    self.filemenu.add_command(label='Exit', command=self.quit)
    menubar.add_cascade(label='File', menu=self.filemenu)
    editmenu = tk.Menu(menubar, tearoff=0)
    editmenu.add_command(label='Cut', command=(lambda : self.focus_get().event_generate('<<Cut>>')))
    editmenu.add_command(label='Copy', command=(lambda : self.focus_get().event_generate('<<Copy>>')))
    editmenu.add_command(label='Paste', command=(lambda : self.focus_get().event_generate('<<Paste>>')))
    menubar.add_cascade(label='Edit ', menu=editmenu)
    helpmenu = tk.Menu(menubar, tearoff=0)
    helpmenu.add_command(label='About', command=self.help)
    helpmenu.add_command(label='License', command=self.license)
    menubar.add_cascade(label='Help ', menu=helpmenu)
    self.master.config(menu=menubar)
def create_widgets(self):
    toplevel_frame = ttk.Frame(self, padding='0.1i')
    overall_frame = ttk.Frame(self, padding='0.1i')
    overall_frame.grid(row=0, column=1, sticky=tk.NSEW)
    toplevel_frame.grid(row=0, column=0, sticky=tk.NSEW)
    self.toolbox_list = self.get_toolboxes()
    self.sort_toolboxes()
    self.tools_and_toolboxes = wbt.toolbox()
    self.sort_tools_by_toolbox()
    self.get_tools_list()
    self.tool_icon = tk.PhotoImage(file=(self.script_dir + '//img//tool.gif'))
    self.open_toolbox_icon = tk.PhotoImage(file=(self.script_dir + '//img//open.gif'))
    self.closed_toolbox_icon = tk.PhotoImage(file=(self.script_dir + '//img//closed.gif'))
    self.tools_frame = ttk.LabelFrame(toplevel_frame, text='{} Available Tools'.format(len(self.tools_list)), padding='0.1i')
    self.tool_tree = ttk.Treeview(self.tools_frame, height=21)
    self.tool_tree.grid(row=0, column=0, sticky=tk.NSEW)
    self.tool_tree.column('#0', width=280)
    self.tools_frame.grid(row=0, column=0, sticky=tk.NSEW)
    self.tools_frame.columnconfigure(0, weight=10)
    self.tools_frame.columnconfigure(1, weight=1)
    self.tools_frame.rowconfigure(0, weight=10)
    self.tools_frame.rowconfigure(1, weight=1)
    index = 0
    for toolbox in self.lower_toolboxes:
        if (toolbox.find('/') != (- 1)):
            self.tool_tree.insert(toolbox[:toolbox.find('/')], 0, text=('  ' + toolbox[(toolbox.find('/') + 1):]), iid=toolbox[(toolbox.find('/') + 1):], tags='toolbox', image=self.closed_toolbox_icon)
            for tool in self.sorted_tools[index]:
                self.tool_tree.insert(toolbox[(toolbox.find('/') + 1):], 'end', text=('  ' + tool), tags='tool', iid=tool, image=self.tool_icon)
        else:
            self.tool_tree.insert(, 'end', text=('  ' + toolbox), iid=toolbox, tags='toolbox', image=self.closed_toolbox_icon)
            for tool in self.sorted_tools[index]:
                self.tool_tree.insert(toolbox, 'end', text=('  ' + tool), iid=tool, tags='tool', image=self.tool_icon)
        index = (index + 1)
    self.tool_tree.tag_bind('tool', '<<TreeviewSelect>>', self.tree_update_tool_help)
    self.tool_tree.tag_bind('toolbox', '<<TreeviewSelect>>', self.update_toolbox_icon)
    s = ttk.Scrollbar(self.tools_frame, orient=tk.VERTICAL, command=self.tool_tree.yview)
    s.grid(row=0, column=1, sticky=(tk.N, tk.S))
    self.tool_tree['yscrollcommand'] = s.set
    self.search_list = []
    self.search_text = tk.StringVar()
    self.search_frame = ttk.LabelFrame(toplevel_frame, padding='0.1i', text='{} Tools Found'.format(len(self.search_list)))
    self.search_label = ttk.Label(self.search_frame, text='Search: ')
    self.search_bar = ttk.Entry(self.search_frame, width=30, textvariable=self.search_text)
    self.search_results_listbox = tk.Listbox(self.search_frame, height=11)
    self.search_scroll = ttk.Scrollbar(self.search_frame, orient=tk.VERTICAL, command=self.search_results_listbox.yview)
    self.search_results_listbox['yscrollcommand'] = self.search_scroll.set
    self.search_results_listbox.bind('<<ListboxSelect>>', self.search_update_tool_help)
    self.search_bar.bind('<Return>', self.update_search)
    self.search_frame.grid(row=1, column=0, sticky=tk.NSEW)
    self.search_label.grid(row=0, column=0, sticky=tk.NW)
    self.search_bar.grid(row=0, column=1, sticky=tk.NE)
    self.search_results_listbox.grid(row=1, column=0, columnspan=2, sticky=tk.NSEW, pady=5)
    self.search_scroll.grid(row=1, column=2, sticky=(tk.N, tk.S))
    self.search_frame.columnconfigure(0, weight=1)
    self.search_frame.columnconfigure(1, weight=10)
    self.search_frame.columnconfigure(1, weight=1)
    self.search_frame.rowconfigure(0, weight=1)
    self.search_frame.rowconfigure(1, weight=10)
    self.current_tool_frame = ttk.Frame(overall_frame, padding='0.01i')
    self.current_tool_lbl = ttk.Label(self.current_tool_frame, text='Current Tool: {}'.format(self.tool_name), justify=tk.LEFT)
    self.view_code_button = ttk.Button(self.current_tool_frame, text='View Code', width=12, command=self.view_code)
    self.view_code_button.grid(row=0, column=1, sticky=tk.E)
    self.current_tool_lbl.grid(row=0, column=0, sticky=tk.W)
    self.current_tool_frame.grid(row=0, column=0, columnspan=2, sticky=tk.NSEW)
    self.current_tool_frame.columnconfigure(0, weight=1)
    self.current_tool_frame.columnconfigure(1, weight=1)
    self.arg_scroll_frame = ttk.Frame(overall_frame, padding='0.0i')
    self.arg_scroll_frame.grid(row=1, column=0, sticky=tk.NSEW)
    self.arg_scroll_frame.columnconfigure(0, weight=1)
    buttons_frame = ttk.Frame(overall_frame, padding='0.1i')
    self.run_button = ttk.Button(buttons_frame, text='Run', width=8, command=self.run_tool)
    self.quit_button = ttk.Button(buttons_frame, text='Cancel', width=8, command=self.cancel_operation)
    self.help_button = ttk.Button(buttons_frame, text='Help', width=8, command=self.tool_help_button)
    self.run_button.grid(row=0, column=0)
    self.quit_button.grid(row=0, column=1)
    self.help_button.grid(row=0, column=2)
    buttons_frame.grid(row=2, column=0, columnspan=2, sticky=tk.E)
    output_frame = ttk.Frame(overall_frame)
    outlabel = ttk.Label(output_frame, text='Output:', justify=tk.LEFT)
    self.out_text = ScrolledText(output_frame, width=63, height=15, wrap=tk.NONE, padx=7, pady=7, exportselection=0)
    output_scrollbar = ttk.Scrollbar(output_frame, orient=tk.HORIZONTAL, command=self.out_text.xview)
    self.out_text['xscrollcommand'] = output_scrollbar.set
    k = wbt.tool_help(self.tool_name)
    self.out_text.insert(tk.END, k)
    outlabel.grid(row=0, column=0, sticky=tk.NW)
    self.out_text.grid(row=1, column=0, sticky=tk.NSEW)
    output_frame.grid(row=3, column=0, columnspan=2, sticky=(tk.NS, tk.E))
    output_scrollbar.grid(row=2, column=0, sticky=(tk.W, tk.E))
    self.out_text.columnconfigure(0, weight=1)
    output_frame.columnconfigure(0, weight=1)
    if (_platform == 'darwin'):
        self.out_text.bind('<Command-Key-a>', self.select_all)
    else:
        self.out_text.bind('<Control-Key-a>', self.select_all)
    progress_frame = ttk.Frame(overall_frame, padding='0.1i')
    self.progress_label = ttk.Label(progress_frame, text='Progress:', justify=tk.LEFT)
    self.progress_var = tk.DoubleVar()
    self.progress = ttk.Progressbar(progress_frame, orient='horizontal', variable=self.progress_var, length=200, maximum=100)
    self.progress_label.grid(row=0, column=0, sticky=tk.E, padx=5)
    self.progress.grid(row=0, column=1, sticky=tk.E)
    progress_frame.grid(row=4, column=0, columnspan=2, sticky=tk.SE)
    self.tool_tree.focus(self.tool_name)
    self.tool_tree.selection_set(self.tool_name)
    self.tool_tree.event_generate('<<TreeviewSelect>>')
    menubar = tk.Menu(self)
    self.filemenu = tk.Menu(menubar, tearoff=0)
    self.filemenu.add_command(label='Set Working Directory', command=self.set_directory)
    self.filemenu.add_command(label='Locate WhiteboxTools exe', command=self.select_exe)
    self.filemenu.add_command(label='Refresh Tools', command=self.refresh_tools)
    wbt.set_compress_rasters(True)
    self.filemenu.add_command(label='Do Not Compress Output TIFFs', command=self.update_compress)
    self.filemenu.add_separator()
    self.filemenu.add_command(label='Exit', command=self.quit)
    menubar.add_cascade(label='File', menu=self.filemenu)
    editmenu = tk.Menu(menubar, tearoff=0)
    editmenu.add_command(label='Cut', command=(lambda : self.focus_get().event_generate('<<Cut>>')))
    editmenu.add_command(label='Copy', command=(lambda : self.focus_get().event_generate('<<Copy>>')))
    editmenu.add_command(label='Paste', command=(lambda : self.focus_get().event_generate('<<Paste>>')))
    menubar.add_cascade(label='Edit ', menu=editmenu)
    helpmenu = tk.Menu(menubar, tearoff=0)
    helpmenu.add_command(label='About', command=self.help)
    helpmenu.add_command(label='License', command=self.license)
    menubar.add_cascade(label='Help ', menu=helpmenu)
    self.master.config(menu=menubar)