im doing a calculator and im trying to give a message when the typed on the input is not an int rather than the program just closing(on the exe file),it gives an error when running in vscode.can someone help me? this is the code:
if window == janela1 and events == 'Calcular Resultados':
op = ipt['f']
te1 = int(ipt['t1'])
te2 = int(ipt['t2'])
tc1 = ipt['t1']
check1 = isinstance(tc1, int)
if check1 == False:
def erro404():
er4 = [
[sg.Text('Estes campo devem ser preenchidos com numeros')],
[sg.Button('Fechar programa'), sg.Button('Voltar')]
]
return sg.Window('MathMatrix', er4, finalize=True)
janela1.hide()
janela8 = erro404()
window7, eventos6, ipt7 = sg.read_all_windows()
if window7 == janela8 and eventos6 == 'Voltar':
window['t1']('')
window['t2']('')
window['f']('')
janela8.hide()
janela1.un_hide()
if window7 == janela8 and eventos6 == 'Fechar programa':
break
the ipt's are inputs, im using pysimplegui for the interface, im a beginner so dumb code may exist. the error i get is this one Traceback (most recent call last): File "c:\Meus_Projetos\MathMatrix\main.py", line 69, in te1 = int(ipt['t1']) ^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'rr'