def getValueFromWidget(self, widget): typ = type(widget) if typ == QtWidgets.QLineEdit: return widget.text() elif typ == QtWidgets.QSpinBox or typ == QtWidgets.QDoubleSpinBox: return widget.value()