0
Hello, I am trying to convert a received value from a graphical interface to int or float, to make a software that solves the second degree equations.
layout = [ [sg.Text('Termo A:'), sg.InputText()], #os valores colocados aqui devem ser convertidos para float ou int
[sg.Text('Termo B:'), sg.InputText()],
[sg.Text('Termo C:'), sg.InputText()],
[sg.Ok(), sg.Cancel()]]
I have tried several things to convert these values, but none worked.
elif event in (sg.ok, 'Ok'):
valor_float = float(values)
print (type(valor_float[0]))
In the above example of the following error:
Typeerror: float() argument must be a string or a number, not 'Dict'
I am using the Pysimplegui library. Thanks in advance.
But it won’t work anyway. The value you are trying to convert, according to the error message, is a dictionary. Probably the target value of this conversion should be inside this dictionary.
– Augusto Vasques
Hello Elisha, it is important [Dit] your question and explain objectively and punctually the difficulty found, accompanied by a [mcve] of the problem. To better enjoy the site, understand and avoid closures is worth reading the Stack Overflow Survival Guide in English. So we can help. Thank you for understanding.
– Guilherme Nascimento