How do I convert a number in a LineEdit widget to float?
Say I have:
textfield = QtGui.QLineEdit(self)
And the user inputs 12345.2 in it. I want that to be converted to a float and stored in a variable X. How do I do it?
I tried the code below, it doesn’t work.
INPUT = textfield.text
INPUT2 = float(INPUT)
textis the name of the method. You should call it to get the text inside theQLineEdit.