def __init__(self, parent, app=None): tk.Frame.__init__(self, parent) background = self.cget("background") self.app = app self.pages = [] self.nodelist = [] self.current_page = None # within the frame are two panes; the left has a tree, # the right shows the current page. We need a splitter self.pw = tk.PanedWindow(self, orient="horizontal", background="#f58735", borderwidth=1, relief='solid', sashwidth=3) self.pw.pack(side="top", fill="both", expand=True, pady=(4, 1), padx=4) self.left = tk.Frame(self.pw, background=background, borderwidth=0, highlightthickness=0) self.right = tk.Frame(self.pw, background="white", width=600, height=600, borderwidth=0, highlightthickness=0) self.pw.add(self.left) self.pw.add(self.right) self.list = TabList(self.left) vsb = AutoScrollbar(self.left, command=self.list.yview, orient="vertical") hsb = AutoScrollbar(self.left, command=self.list.xview, orient="horizontal") self.list.configure(xscrollcommand=hsb.set, yscrollcommand=vsb.set) self.list.grid(row=0, column=1, sticky="nsew", padx=0, pady=0) vsb.grid(row=0, column=0, sticky="ns") hsb.grid(row=1, column=1, sticky="ew") self.left.grid_rowconfigure(0, weight=1) self.left.grid_columnconfigure(1, weight=1) self.list.bind("<<ListboxSelect>>", self.on_list_selection) # start with them invisible; they will reappear when needed vsb.grid_remove() hsb.grid_remove()
def _create_list(self, parent): listframe = ttk.Frame(parent, width=200, borderwidth=0) self.lib_tree = ttk.Treeview(listframe, selectmode="browse", columns=["id"], displaycolumns=[]) self.lib_tree.heading("#0", text="Libraries", anchor="w") self.lib_tree_vsb = AutoScrollbar(listframe, orient="vertical", command=self.lib_tree.yview) self.lib_tree.configure(yscrollcommand=self.lib_tree_vsb.set) self.keyword_tree = ttk.Treeview(listframe, columns=["kw_id", "source","description"], displaycolumns=["source", "description"]) self.keyword_tree.column("source", width=120, stretch=False) self.keyword_tree.heading("#0", text="Keyword Name", anchor="w") self.keyword_tree.heading("source", text="Source", anchor="w") self.keyword_tree.heading("description", text="Description", anchor="w") self.keyword_tree_ysb = AutoScrollbar(listframe, orient="vertical", command=self.keyword_tree.yview) self.keyword_tree.configure(yscrollcommand=self.keyword_tree_ysb.set) self.lib_tree.grid(row=0, column=0, sticky="nsew") self.lib_tree_vsb.grid(row=0, column=1, sticky="ns") self.keyword_tree.grid(row=0, column=2, sticky="nsew") self.keyword_tree_ysb.grid(row=0, column=3, sticky="ns") listframe.grid_rowconfigure(0, weight=1) listframe.grid_columnconfigure(2, weight=1) return listframe
def _create_data(self, parent): dataframe = ttk.Frame(parent, borderwidth=1, relief="sunken") self.text = CustomText(dataframe, wrap="word", borderwidth=0, width=120, font=self.app.fonts.default, highlightthickness=0) self.text_ysb = AutoScrollbar(dataframe, orient="vertical", command=self.text.yview) self.text.configure(yscrollcommand=self.text_ysb.set) self.text.grid(row=0, column=0, sticky="nsew", padx=4) self.text_ysb.grid(row=0, column=1, sticky="ns") dataframe.grid_rowconfigure(0, weight=1) dataframe.grid_columnconfigure(0, weight=1) self.text.tag_configure("name", font=self.app.fonts.heading) self.text.tag_configure("args", font=self.app.fonts.italic) self.text.tag_configure("example", background="lightgray", font=self.app.fonts.fixed) self.text.tag_configure("search_string", background="yellow", borderwidth=1, relief="raised") self.text.tag_raise("sel") return dataframe