Changeset 4499 for trunk/GSASIIctrlGUI.py
- Timestamp:
- Jun 19, 2020 4:19:13 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrlGUI.py
r4498 r4499 1057 1057 return # Returning without calling event.Skip, which eats the keystroke 1058 1058 1059 def G2SliderWidget(parent,loc,key,label,xmin,xmax,iscale): 1059 def G2SliderWidget(parent,loc,key,label,xmin,xmax,iscale, 1060 onChange=None,onChangeArgs=[]): 1060 1061 '''A customized combination of a wx.Slider and a validated 1061 1062 wx.TextCtrl (see :class:`ValidatedTxtCtrl`) that allows either … … 1081 1082 :param float iscale: number to scale values to integers which is what the 1082 1083 Scale widget uses. If the xmin=1 and xmax=4 and iscale=1 then values 1083 only the values 1,2,3 and 4 can be set with the slider. If 1084 only the values 1,2,3 and 4 can be set with the slider. 1085 1086 :param callable onChange: function to call when value is changed. 1087 Default is None where nothing will be called. 1084 1088 1089 :param list onChangeArgs: arguments to be passed to onChange function 1090 when called. 1085 1091 :returns: returns a wx.BoxSizer containing the widgets 1086 1092 ''' … … 1089 1095 loc[key] = vScale.GetValue()/float(iscale) 1090 1096 wx.TextCtrl.SetValue(vEntry,str(loc[key])) # will not trigger onValSet 1097 if onChange: onChange(*onChangeArgs) 1091 1098 def onValSet(*args,**kwargs): 1092 1099 vScale.SetValue(int(0.5+iscale*loc[key])) 1100 if onChange: onChange(*onChangeArgs) 1093 1101 loc[key] = min(xmax,max(xmin,loc[key])) 1094 1102 hSizer = wx.BoxSizer(wx.HORIZONTAL)
Note: See TracChangeset
for help on using the changeset viewer.