def __init__(self, title, parent=None): super().__init__(title, parent) self.sl = gpi.BasicCWFCSliders() self.sl.valueChanged.connect(self.valueChanged) # at least one button self.button_names = ['C/W'] self.buttons = [] cnt = 0 wdgLayout = QtWidgets.QGridLayout() for name in self.button_names: newbutton = QtWidgets.QPushButton(name) newbutton.setCheckable(True) newbutton.setAutoExclusive(True) self.buttons.append(newbutton) newbutton.clicked.connect(self.findValue) newbutton.clicked.connect(self.valueChanged) wdgLayout.addWidget(newbutton, 0, cnt, 1, 1) cnt += 1 # layout wdgLayout.addWidget(self.sl, 1, 0, 1, 4) wdgLayout.setVerticalSpacing(0) wdgLayout.setSpacing(0) self.setLayout(wdgLayout) # default self.set_min(1) self._selection = 0 # pass is default #self.buttons[self._selection].setChecked(True) self.sl.set_allvisible(False)
def __init__(self, title, parent=None): super().__init__(title, parent) self.sl = gpi.BasicCWFCSliders() self.sl.valueChanged.connect(self.valueChanged) self.pb = gpi.BasicPushButton() self.pb.set_button_title('reset') # layout wdgLayout = QtWidgets.QVBoxLayout() wdgLayout.addWidget(self.sl) wdgLayout.addWidget(self.pb) self.setLayout(wdgLayout) # default self.set_min(0) self.set_max(100) self.sl.set_allvisible(True) self.reset_sliders() self.pb.valueChanged.connect(self.reset_sliders)