Open
Description
I have problem , with last version , not work same codice work like on pysimplegui .
import FreeSimpleGUI as sg
# Definindo a layout da calculadora
layout = [
[sg.Text('Calculadora')],
[sg.InputText(key='-DISPLAY-')],
[sg.Button('7'), sg.Button('8'), sg.Button('9'), sg.Button('+')],
[sg.Button('4'), sg.Button('5'), sg.Button('6'), sg.Button('-')],
[sg.Button('1'), sg.Button('2'), sg.Button('3'), sg.Button('*')],
[sg.Button('0'), sg.Button('.'), sg.Button('='), sg.Button('/')],
[sg.Button('C')]
]
# Criando a janela da calculadora
window = sg.Window('Calculadora', layout)
while True:
# Lendo eventos
event, values = window.read()
if event == 'C': # Botão "C" para limpar a tela
window['-DISPLAY-'].update('')
elif event == '=': # Botão "=" para calcular
try:
resultado = eval(values['-DISPLAY-'])
window['-DISPLAY-'].update(str(resultado))
except Exception as e:
window['-DISPLAY-'].update('Error')
else: # Atualizando a tela com o valor do botão pressionado
window['-DISPLAY-'].update(values['-DISPLAY-'] + event)
# Fecha a janela da calculadora quando fechada pelo usuário
window.close()
>>>python3 --version
Python 3.13.1
>>>brew list python-tk
/opt/homebrew/Cellar/[email protected]/3.13.1/libexec/_tkinter.cpython-313-darwin.so
/opt/homebrew/Cellar/[email protected]/3.13.1/sbom.spdx.json
>>>sw_vers
ProductName: macOS
ProductVersion: 14.5
BuildVersion: 23F79
>>>pip list
Package Version
-------------------- ---------
engineering-notation 0.10.0
FreeSimpleGUI 5.1.1
FreeSimpleGUIWeb 1.0.0
pip 25.0
pyasn1 0.6.1
PySimpleGUI 5.0.8
remi 2020.3.10
rsa 4.9
stringify 0.1.1
tk 0.1.0
tk-tools 0.17.0
wheel 0.45.1
Error :
Exception has occurred: TclError
bad option "variable": must be add, info, or remove
File "/Users/XXX/Downloads/import FreeSimpleGUI as sg.py", line 19, in <module>
event, values = window.read()
~~~~~~~~~~~^^
_tkinter.TclError: bad option "variable": must be add, info, or remove