def keyPressEvent(self, ev): if ev.key() == Qt.Key_Space: self.setValue(-1000000) else: return QSpinBox.keyPressEvent(self, ev)