def __init__(self): super().__init__() self.ui = Ui_Calc() self.ui.setupUi(self) self.ui.inputSpinBox1.valueChanged.connect(self.result1) self.ui.inputSpinBox2.valueChanged.connect(self.result2)
class MyCalc(QWidget): def __init__(self, parent=None): super().__init__(parent) self.ui = Ui_Calc() self.ui.setupUi(self) @pyqtSlot(int) def on_inputSpinBox1_valueChanged(self, value): self.ui.outputWidget.setText(str(value + self.ui.inputSpinBox2.value())) @pyqtSlot(int) def on_inputSpinBox2_valueChanged(self, value): self.ui.outputWidget.setText(str(value + self.ui.inputSpinBox1.value()))
class MyCalc(QWidget): def __init__(self): super().__init__() self.ui = Ui_Calc() self.ui.setupUi(self) self.ui.inputSpinBox1.valueChanged.connect(self.result1) self.ui.inputSpinBox2.valueChanged.connect(self.result2) def result1(self, value): self.ui.outputWidget.setText(str(value + self.ui.inputSpinBox2.value())) def result2(self, value): self.ui.outputWidget.setText(str(value + self.ui.inputSpinBox1.value()))
def __init__(self, parent=None): super().__init__(parent) self.ui = Ui_Calc() self.resize(250, 150) self.ui.setupUi(self)
def __init__(self, parent=None): super().__init__(parent) self.setWindowTitle('calculater') self.ui = Ui_Calc() self.ui.setupUi(self)