结果表格增加水平滚动条

This commit is contained in:
2026-05-15 21:40:13 +08:00
parent 1218d40184
commit 2489684dad
+9 -4
View File
@@ -281,12 +281,17 @@ class App:
col_widths = [140, 80, 60, 100, 100, 70, 100, 80, 140]
for col, width in zip(columns, col_widths):
self.result_tree.heading(col, text=col)
self.result_tree.column(col, width=width, anchor="center")
self.result_tree.pack(side="left", fill="both", expand=True)
self.result_tree.column(col, width=width, anchor="center", stretch=False)
scroll_y = Scrollbar(result_frame, orient=VERTICAL, command=self.result_tree.yview)
scroll_y.pack(side=RIGHT, fill=Y)
self.result_tree.configure(yscrollcommand=scroll_y.set)
scroll_x = Scrollbar(result_frame, orient=HORIZONTAL, command=self.result_tree.xview)
self.result_tree.configure(yscrollcommand=scroll_y.set, xscrollcommand=scroll_x.set)
self.result_tree.grid(row=0, column=0, sticky="nsew")
scroll_y.grid(row=0, column=1, sticky="ns")
scroll_x.grid(row=1, column=0, sticky="ew")
result_frame.grid_rowconfigure(0, weight=1)
result_frame.grid_columnconfigure(0, weight=1)
# ─── 配置管理 ───────────────────────────────────────────