diff --git a/src/main.py b/src/main.py index 863e8e3..9a18d2e 100644 --- a/src/main.py +++ b/src/main.py @@ -30,11 +30,20 @@ def main() -> None: frm = ttk.Frame(root, padding=10) frm.grid() + columns = ("title", "page") + toc_tree = ttk.Treeview(frm, columns=columns, show="headings") + toc_tree.heading("title", text="Title") + toc_tree.heading("page", text="Page") + toc_tree.grid(column=0, row=1) + + for lvl, t, p in toc: + toc_tree.insert("", tkinter.END, values=(" " * lvl + t, str(p))) + page_title = ttk.Label(frm) - page_title.grid(column=1, row=0) + page_title.grid(column=2, row=0) page_view = ttk.Label(frm) - page_view.grid(column=1, row=1) + page_view.grid(column=2, row=1) def load_page(page_num: int): page = doc[page_num] @@ -58,8 +67,8 @@ def main() -> None: CURRENT_PAGE -= 1 load_page(CURRENT_PAGE) - ttk.Button(frm, text="Previous", command=previous_page).grid(column=0, row=1) - ttk.Button(frm, text="Next", command=next_page).grid(column=2, row=1) + ttk.Button(frm, text="Previous", command=previous_page).grid(column=1, row=1) + ttk.Button(frm, text="Next", command=next_page).grid(column=3, row=1) load_page(CURRENT_PAGE)