Skip to content

Commit ba0c90a

Browse files
authored
Improve resize of Treeview in page labels dialog (#1872)
1. If user grows dialog horizontally, stretch the columns 2. Set the row height based on the font size (affects all Treeviews: HTML internal links; Compose Help dialog; Command Palette; Unicode Search dialog results
1 parent f723949 commit ba0c90a

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/guiguts/page_details.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def __init__(self, page_details: PageDetails) -> None:
145145
f"#{col + 1}",
146146
minwidth=10,
147147
width=widths[col],
148-
stretch=False,
148+
stretch=True,
149149
anchor=tk.CENTER,
150150
)
151151
self.list.heading(f"#{col + 1}", text=column)

src/guiguts/widgets.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,17 @@ def __init__(
764764
bordercolor=[("focus", bg_color)],
765765
relief=[("focus", "solid")],
766766
)
767+
# Ensure rowheight is sufficient for font size
768+
fnt = get_global_font()
769+
rowheight = fnt.metrics("linespace") + 4
770+
themed_style().configure(
771+
"Custom.Treeview",
772+
rowheight=rowheight,
773+
)
774+
themed_style().configure(
775+
"Custom.Treeview.Heading",
776+
rowheight=rowheight,
777+
)
767778

768779
super().__init__(parent, style="Custom.Treeview", **kwargs)
769780
self.bind("<Home>", lambda _e: self.select_and_focus_by_index(0))

0 commit comments

Comments
 (0)