1

I have done a python script and I want to change the '1.0' value on pas15 with the value that is set in the double spin box, but I can't find the way to do it. Any idea?

self.dlg.doubleSpinBox.valueChanged[str].connect(self.value)  

def value(self):
    self.value=QDoubleSpinBox.getValue()  
pas15=processing.runalg('saga:contourlinesfromgrid',self.input,0.0,5000.0,1.0,None)
0

You are mixing classes, instances and method names.

  • When you get the value, which QDoubleSpinBox should it be retrieved from? Don't specify the class name QDoubleSpinBox, specify the instance self.dlg.doubleSpinBox.
  • When you code, make sure you have the Qt API documentation close so you can check method names: http://doc.qt.io/qt-4.8/qdoublespinbox.html.

self.dlg.doubleSpinBox.valueChanged.connect(self.onValueChanged)  

def onValueChanged(self):
    self.value=self.dlg.doubleSpinBox.value()

You can also make it simpler, because you get the value with the signal

def onValueChanged(self, newValue):
    self.value=newValue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.