@@ -118,56 +118,44 @@ def __init__(self, settings_tab, *args, **kwargs):
118
118
Keyword arguments for ttk.LabelFrame
119
119
"""
120
120
# Init Frame
121
- text_label = "Camera Modes "
121
+ text_label = "Camera Mode "
122
122
ttk .Labelframe .__init__ (self , settings_tab , text = text_label , * args , ** kwargs )
123
123
124
- # Formatting
125
- tk .Grid .columnconfigure (self , "all" , weight = 1 )
126
- tk .Grid .rowconfigure (self , "all" , weight = 1 )
127
-
128
- # Holds dropdowns, this is done in case more widgets are to be added in a
129
- # different frame, these can be grouped together
130
- #: ttk.Frame: The parent frame for any widgets you add.
131
- content_frame = ttk .Frame (self )
132
- content_frame .grid (row = 0 , column = 0 , sticky = tk .NSEW , pady = 5 )
133
-
134
- # Formatting
135
- tk .Grid .columnconfigure (content_frame , "all" , weight = 1 )
136
- tk .Grid .rowconfigure (content_frame , "all" , weight = 1 )
137
-
138
- # Dictionary for all the variables, this will be used by the controller
139
124
#: dict: Dictionary of all the widgets in the frame.
140
125
self .inputs = {}
126
+
141
127
#: list: List of all the labels for the widgets.
142
128
self .labels = ["Sensor Mode" , "Readout Direction" , "Number of Pixels" ]
129
+
143
130
#: list: List of all the names for the widgets.
144
131
self .names = ["Sensor" , "Readout" , "Pixels" ]
145
132
133
+ for i in range (len (self .labels )):
134
+ self .rowconfigure (i , weight = 1 , uniform = "1" )
135
+ for i in range (2 ):
136
+ self .columnconfigure (i , weight = 1 , uniform = "1" )
137
+
146
138
# Dropdown loop
147
139
for i in range (len (self .labels )):
140
+ label = ttk .Label (self , text = self .labels [i ])
141
+ label .grid (row = i , column = 0 , pady = 3 , padx = 5 , sticky = tk .W )
142
+
148
143
if i < len (self .labels ) - 1 :
149
144
self .inputs [self .names [i ]] = LabelInput (
150
- parent = content_frame ,
151
- label = self .labels [i ],
145
+ parent = self ,
152
146
input_class = ttk .Combobox ,
153
147
input_var = tk .StringVar (),
154
148
input_args = {"width" : 12 },
155
149
)
156
- self .inputs [self .names [i ]].grid (row = i , column = 0 , pady = 3 , padx = 5 )
157
150
else :
158
151
self .inputs [self .names [i ]] = LabelInput (
159
- parent = content_frame ,
160
- label = self .labels [i ],
152
+ parent = self ,
161
153
input_class = ValidatedSpinbox ,
162
154
input_var = tk .StringVar (),
163
155
input_args = {"from_" : 0 , "to" : 10000 , "increment" : 1 , "width" : 5 },
164
156
)
165
- self .inputs [self .names [i ]].grid (row = i , column = 0 , pady = 3 , padx = 5 )
166
-
167
- # Additional widget settings
168
- self .inputs ["Sensor" ].label .grid (padx = (0 , 36 ))
169
- self .inputs ["Readout" ].label .grid (padx = (0 , 10 ))
170
- self .inputs ["Pixels" ].label .grid (padx = (0 , 15 ))
157
+ self .inputs [self .names [i ]].grid (
158
+ row = i , column = 1 , pady = 3 , padx = 5 , sticky = tk .W )
171
159
172
160
def get_variables (self ):
173
161
"""Get Variables.
@@ -229,63 +217,55 @@ def __init__(self, settings_tab, *args, **kwargs):
229
217
text_label = "Framerate Info"
230
218
ttk .LabelFrame .__init__ (self , settings_tab , text = text_label , * args , ** kwargs )
231
219
232
- # Holds widgets, this is done in case more widgets are to be
233
- # added in a different frame, these can be grouped together
234
- content_frame = ttk .Frame (self )
235
- content_frame .grid (row = 0 , column = 0 , sticky = tk .NSEW , pady = 5 , padx = 5 )
236
-
237
- # Formatting
238
- tk .Grid .columnconfigure (self , "all" , weight = 1 )
239
- tk .Grid .rowconfigure (self , "all" , weight = 1 )
240
- tk .Grid .columnconfigure (content_frame , "all" , weight = 1 )
241
- tk .Grid .rowconfigure (content_frame , "all" , weight = 1 )
242
-
243
- # Dictionary for all the variables, this will be used by the controller
244
220
#: dict: Dictionary of all the widgets in the frame.
245
221
self .inputs = {}
222
+
246
223
#: list: List of all the labels for the widgets.
247
224
self .labels = [
248
225
"Exposure Time (ms)" ,
249
226
"Readout Time (ms)" ,
250
227
"Framerate (Hz)" ,
251
228
"Images to Average" ,
252
229
]
230
+
253
231
#: list: List of all the names for the widget values.
254
232
self .names = [
255
233
"exposure_time" ,
256
234
"readout_time" ,
257
235
"max_framerate" ,
258
236
"frames_to_average" ,
259
237
]
238
+
239
+ for i in range (len (self .labels )):
240
+ self .rowconfigure (i , weight = 1 , uniform = "1" )
241
+ for i in range (2 ):
242
+ self .columnconfigure (i , weight = 1 , uniform = "1" )
243
+
260
244
#: list: List of all the read only values for the widgets.
261
245
self .read_only = [True , True , True , False ]
262
246
263
247
# Dropdown loop
264
248
for i in range (len (self .labels )):
249
+ label = ttk .Label (self , text = self .labels [i ])
250
+ label .grid (row = i , column = 0 , pady = 1 , padx = 5 , sticky = tk .W )
251
+
265
252
if self .read_only [i ]:
266
253
self .inputs [self .names [i ]] = LabelInput (
267
- parent = content_frame ,
268
- label = self .labels [i ],
254
+ parent = self ,
269
255
input_class = ValidatedEntry ,
270
256
input_var = tk .DoubleVar (),
271
257
input_args = {"width" : 6 },
272
258
)
273
259
self .inputs [self .names [i ]].widget ["state" ] = "readonly"
274
- self .inputs [self .names [i ]].grid (row = i , column = 0 , pady = 1 )
275
260
else :
276
261
self .inputs [self .names [i ]] = LabelInput (
277
- parent = content_frame ,
278
- label = self .labels [i ],
262
+ parent = self ,
279
263
input_class = ValidatedSpinbox ,
280
264
input_var = tk .DoubleVar (),
281
265
input_args = {"from_" : 1 , "to" : 1000 , "increment" : 1.0 , "width" : 6 },
282
266
)
283
- self .inputs [self .names [i ]].grid (row = i , column = 0 , pady = 1 )
267
+ self .inputs [self .names [i ]].grid (row = i , column = 1 , pady = 1 , padx = 5 , sticky = tk . W )
284
268
285
- self .inputs ["exposure_time" ].label .grid (padx = (0 , 10 ))
286
- self .inputs ["readout_time" ].label .grid (padx = (0 , 14 ))
287
- self .inputs ["max_framerate" ].label .grid (padx = (0 , 10 ))
288
- self .inputs ["frames_to_average" ].label .grid (padx = (0 , 16 ))
289
269
290
270
def get_variables (self ):
291
271
"""Get Variables
0 commit comments