@@ -133,18 +133,22 @@ def create_widgets(self):
133133 header = tk .Frame (self .root , bg = self .CLR_HEADER ); header .pack (side = 'top' , fill = 'x' )
134134 ttk .Label (header , text = f"Active R-T Sweep (K2400) v{ self .PROGRAM_VERSION } " , style = 'Header.TLabel' , font = self .FONT_TITLE ).pack (side = 'left' , padx = 20 , pady = 10 )
135135 main_pane = ttk .PanedWindow (self .root , orient = 'horizontal' ); main_pane .pack (fill = 'both' , expand = True , padx = 10 , pady = 10 )
136-
137- # --- FIX: Create both panels first, then add them to the PanedWindow ---
138- left_panel = self ._create_left_panel (main_pane )
139- right_panel = self ._create_right_panel (main_pane )
136+
137+ # --- FIX: Create empty panels, add them to the PanedWindow, THEN populate them. ---
138+ left_panel = ttk .Frame (main_pane , padding = 5 )
139+ right_panel = ttk .Frame (main_pane , padding = 5 )
140+
140141 main_pane .add (left_panel , weight = 2 )
141142 main_pane .add (right_panel , weight = 3 )
142-
143- def _create_left_panel (self , parent ):
144- panel = ttk .Frame (parent , padding = 5 ); panel .grid_columnconfigure (0 , weight = 1 ); panel .grid_rowconfigure (3 , weight = 1 )
143+
144+ # Now that the PanedWindow is correctly structured, populate the panels.
145+ self ._populate_left_panel (left_panel )
146+ self ._populate_right_panel (right_panel )
147+
148+ def _populate_left_panel (self , panel ):
149+ panel .grid_columnconfigure (0 , weight = 1 ); panel .grid_rowconfigure (3 , weight = 1 )
145150 self ._create_info_panel (panel , 0 )
146151 self ._create_params_panel (panel , 1 ); self ._create_control_panel (panel , 2 ); self ._create_console_panel (panel , 3 )
147- return panel
148152
149153 def _create_info_panel (self , parent , grid_row ):
150154 frame = ttk .LabelFrame (parent , text = 'Information' ); frame .grid (row = grid_row , column = 0 , sticky = 'new' , pady = 5 )
@@ -162,16 +166,14 @@ def _create_info_panel(self, parent, grid_row):
162166 info_text = ("Institute: UGC DAE CSR, Mumbai\n Measurement: R vs. T Sweep (Active)\n Instruments: K2400, LS350" )
163167 ttk .Label (frame , text = info_text , justify = 'left' ).grid (row = 0 , column = 1 , rowspan = 2 , sticky = 'w' , padx = 5 )
164168
165- def _create_right_panel (self , parent ):
166- panel = ttk .Frame (parent , padding = 5 )
169+ def _populate_right_panel (self , panel ):
167170 container = ttk .LabelFrame (panel , text = 'Live R-T Curve' ); container .pack (fill = 'both' , expand = True )
168171 self .figure = Figure (dpi = 100 , facecolor = 'white' )
169172 self .ax_main = self .figure .add_subplot (111 )
170173 self .line_main , = self .ax_main .plot ([], [], color = self .CLR_ACCENT_RED , marker = 'o' , markersize = 4 , linestyle = '-' )
171174 self .ax_main .set_title ("Waiting for experiment..." , fontweight = 'bold' ); self .ax_main .set_xlabel ("Temperature (K)" ); self .ax_main .set_ylabel ("Resistance (Ω)" )
172175 self .ax_main .grid (True , linestyle = '--' , alpha = 0.6 ); self .figure .tight_layout ()
173176 self .canvas = FigureCanvasTkAgg (self .figure , container ); self .canvas .get_tk_widget ().pack (fill = 'both' , expand = True , padx = 5 , pady = 5 )
174-
175177 def _create_params_panel (self , parent , grid_row ):
176178 container = ttk .Frame (parent ); container .grid (row = grid_row , column = 0 , sticky = 'new' , pady = 5 )
177179 container .grid_columnconfigure ((0 , 1 ), weight = 1 ); self .entries = {}
0 commit comments