Arrange GUI controls in two columns: supply+load (left), meter (right)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -88,25 +88,21 @@ class TestbenchGUI(tk.Tk):
|
||||
# Main content: left controls + right graphs
|
||||
content = ttk.PanedWindow(self, orient=tk.HORIZONTAL)
|
||||
content.pack(fill=tk.BOTH, expand=True, padx=4, pady=4)
|
||||
# Left panel (controls + readout) with scrollbar
|
||||
left_outer = ttk.Frame(content, width=340)
|
||||
left_canvas = tk.Canvas(left_outer, width=320, highlightthickness=0)
|
||||
left_scrollbar = ttk.Scrollbar(left_outer, orient=tk.VERTICAL, command=left_canvas.yview)
|
||||
self._left_frame = ttk.Frame(left_canvas)
|
||||
self._left_frame.bind("<Configure>", lambda e: left_canvas.configure(scrollregion=left_canvas.bbox("all")))
|
||||
left_canvas.create_window((0, 0), window=self._left_frame, anchor="nw")
|
||||
left_canvas.configure(yscrollcommand=left_scrollbar.set)
|
||||
left_canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
|
||||
left_scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
|
||||
# Mouse wheel scrolling
|
||||
def _on_mousewheel(event):
|
||||
left_canvas.yview_scroll(int(-1 * (event.delta / 120)), "units")
|
||||
left_canvas.bind_all("<MouseWheel>", _on_mousewheel)
|
||||
# Left panel: two columns of controls
|
||||
left_outer = ttk.Frame(content)
|
||||
left_outer.columnconfigure(0, weight=1)
|
||||
left_outer.columnconfigure(1, weight=1)
|
||||
content.add(left_outer, weight=0)
|
||||
self._build_supply_controls(self._left_frame)
|
||||
self._build_load_controls(self._left_frame)
|
||||
self._build_meter_readout(self._left_frame)
|
||||
self._build_logging_controls(self._left_frame)
|
||||
# Column 0: Supply + Load
|
||||
left_col0 = ttk.Frame(left_outer)
|
||||
left_col0.grid(row=0, column=0, sticky="nsew", padx=(0, 2))
|
||||
self._build_supply_controls(left_col0)
|
||||
self._build_load_controls(left_col0)
|
||||
self._build_logging_controls(left_col0)
|
||||
# Column 1: Meter
|
||||
left_col1 = ttk.Frame(left_outer)
|
||||
left_col1.grid(row=0, column=1, sticky="nsew", padx=(2, 0))
|
||||
self._build_meter_readout(left_col1)
|
||||
# Right panel (graphs)
|
||||
right_frame = ttk.Frame(content)
|
||||
content.add(right_frame, weight=1)
|
||||
|
||||
Reference in New Issue
Block a user