0

I'm new to Python GUI programming and have got stuck on a small problem. Here is my code:

    for product in products:
        self.productCombo.addItem(product[1],product[0])
        self.taxEntry.setText(product[2])

    self.igst = product[3]
    self.netrate = self.netRateEntry.text()
    self.rate =(float(self.netrate)/100)+(float(self.igst))*100
    print(self.rate)
    self.rateEntry.setText(self.rate)

Getting this error:

File "D:\PyQt\Sellproduct.py", line 180, in Widgets  
self.rate =(float(self.netrate)/100)+(float(self.igst))*100 
ValueError: could not convert string to float:
3
  • 1
    Does this answer your question? Confusing python - Cannot convert string to float Commented Feb 1, 2020 at 6:37
  • Put before this line: print(self.netrate); print(self.igst) and you will see everything. Commented Feb 1, 2020 at 15:12
  • Thank you so much sir it helped me but when I tried print(float(self.netrate)) it is still giving the error that could not convert string to float Commented Feb 1, 2020 at 16:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.