0

I am writing a GUI. My GUI receives an integer input through QLineEdit and the input should be transferred to another python script where it performs calculations. The GUI.py file calls the python file Calculation.py through subprocess.call. When I try to send arguments to Calculation.py, it throws an error :

error "TypeError: Unsupported operand type for /: 'str' and 'int'".

Any help would be much appreciated.

Dadep
  • 2,796
  • 5
  • 27
  • 40
Krish
  • 35
  • 6
  • QLineEdit returns a string, you can convert it to floating or integer. Or better use QSpinBox. – eyllanesc Jul 04 '18 at 09:21
  • I tried QSpinBox. the code is: self.B_value = QtGui.QSpinBox(self) checkBox = QtGui.QCheckBox('Test', self) checkBox.stateChanged.connect(lambda:self.run4('Calculation.py',self.B_value.text())) def run4(self, path, B_value): B_value = int(self.B_value.text()) print(type(B_value)) print(B_value) subprocess.call(['python3', path, 'Calculation.py', B_value], shell=True) Second file "Calculation.py": Value=sys.argv[0] x=0xD0 y=0x00 a = Value print(a) b = int(((a*255)/100)+1) c = b>>4 B_d = c+x print(B_d). error:unsupported operand type(s) for /:'str' and 'int' – Krish Jul 05 '18 at 07:46
  • never put code in the comments, nobody understands it or nobody wanted to understand it. edit your question and add it there, take time and read [ask] – eyllanesc Jul 05 '18 at 07:56
  • Hi eyllansec, problem fixed. thanks for your help. – Krish Jul 05 '18 at 08:35

0 Answers0