I have 2 QSpinBox'es - horTilesNum and verTilesNum. The value of the horizontal one should always be 1.5 times bigger than the number of the vertical one. So when the value of one of those Spinboxes is changed the value of another Spinbox should be updated. I have 2 functions for that but I don't know how to call them when Spinbox values are chenged
self.horTilesNum= QSpinBox(self)
self.horTilesNum.setRange(2,1000)
self.horTilesNum.setStyleSheet("QSpinBox {"
"width: 30px;"
"}")
self.horTilesNum.move(880, 178)
self.verTilesNum = QSpinBox(self)
self.verTilesNum.setRange(2,1000)
self.verTilesNum.setStyleSheet("QSpinBox {"
"width: 30px;"
"}")
self.verTilesNum.move(880, 203)
def update_hor_tiles_spinbox(self):
print("horizontal changed")
def update_ver_tiles_spinbox(self):
print("vertical changed")
try this
self.horTilesNum.valueChanged.connect(self.update_hor_tiles_spinbox)
self.verTilesNum.valueChanged.connect(self.update_ver_tiles_spinbox)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With