Changeset 5366 for trunk/GSASIIctrlGUI.py
- Timestamp:
- Nov 10, 2022 1:16:59 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrlGUI.py
r5360 r5366 34 34 :func:`G2CheckBoxFrontLbl` A version of :class:`G2CheckBox` that places the label 35 35 for the check box in front. Otherwise works the same. 36 :func:`G2RadioButtons` Creates a series of grouped radio buttons. 36 37 :class:`G2SliderWidget` A customized combination of a wx.Slider and a validated 37 38 wx.TextCtrl (see :class:`ValidatedTxtCtrl`). … … 1414 1415 return Sizer 1415 1416 1417 def G2RadioButtons(parent,loc,key,choices,values=None,OnChange=None): 1418 '''A customized version of wx.RadioButton that returns a list 1419 of coupled RadioButtons 1420 1421 :param wx.Panel parent: name of panel or frame that will be 1422 the parent to the widgets. Can be None. 1423 :param dict/list loc: the dict or list with the initial value to be 1424 placed in the CheckBox. 1425 :param int/str key: the dict key or the list index for the value to be 1426 edited by the CheckBox. The ``loc[key]`` element must exist. 1427 The CheckButton will be initialized from this value. 1428 :param list choices: 1429 :param list values: 1430 :param function OnChange: specifies a function or method that will be 1431 called when the CheckBox is changed (Default is None). 1432 The called function is supplied with one argument, the calling event. 1433 ''' 1434 def _OnEvent(event): 1435 if event.GetEventObject() not in buttons: 1436 print('Strange: unknown button') 1437 return 1438 loc[key] = values[buttons.index(event.GetEventObject())] 1439 #log.LogVarChange(self.loc,self.key) 1440 if OnChange: OnChange(event) 1441 if not values: 1442 values = list(range(len(choices))) 1443 buttons = [] 1444 kw = {'style':wx.RB_GROUP} 1445 for i,c in enumerate(choices): 1446 if i == 1: 1447 kw = {} 1448 buttons.append(wx.RadioButton(parent,wx.ID_ANY,c,**kw)) 1449 if loc[key] == values[i]: buttons[-1].SetValue(True) 1450 buttons[-1].Bind(wx.EVT_RADIOBUTTON, _OnEvent) 1451 return buttons 1452 1416 1453 #### Commonly used dialogs ################################################################################ 1417 1454 def CallScrolledMultiEditor(parent,dictlst,elemlst,prelbl=[],postlbl=[],
Note: See TracChangeset
for help on using the changeset viewer.