2016-06-14 3 views
1
def run(self): 
     """Run method that performs all the real work""" 
     # show the dialog 
     self.dlg.show() 
     # Run the dialog event loop 
     x = self.dlg.lineEdit.text() 
     y = self.dlg.lineEdit_2.text() 
     z = int(x)+int(y) 
     result = self.dlg.exec_() 
     # See if OK was pressed 
      # Do something useful here - delete the line containing pass and 
      # substitute with your code. 
     QMessageBox.information(self.iface.mainWindow(),"sum is =", "%d" %z) 

하지만 z=int(x)+int(y) .x를에 ValueError를 표시와 y 라인 편집 box..type에서 X의이고 Y는 내가 x와 y를 추가하는 방법을 ... 유니 코드인가?양자 지리 정보 시스템

+0

오류 메시지를 게시하시기 바랍니다. – SilentMonk

+0

ValueError : 밑이 10 인 int()에 대한 리터럴이 올바르지 않습니다. '' – vijesh

+0

'x'와 'y'의 유형은 무엇입니까? 'print type (x)'를 실행하고'type (y)'를 출력하면이 사실을 알 수 있습니다. 또한 x와 y의 값을 인쇄하십시오. – SilentMonk

답변

0

데프 런 (자동) :

"""Run method that performs all the real work""" 
    # show the dialog 
    self.dlg.show() 
    self.dlg.spinBox.clear() 
    self.dlg.spinBox_2.clear() 

    # Run the dialog event loop 


    result = self.dlg.exec_() 
    if result: 
     x = self.dlg.spinBox.value() 
     y = self.dlg.spinBox_2.value() 
     z = x+y 
    # See if OK was pressed 
     # Do something useful here - delete the line containing pass and 
     # substitute with your code. 
     QMessageBox.information(self.iface.mainWindow(),"sum is =","%d" %z)