I'm trying to create a simple GUI, in which part of the functionality involves allowing the user to point to a file for loading. After that, I need to check it's length and read it etc, but I'm getting issues with the application freezing at a seemingly very basic step.
I'm whittled it down to the most simple repeatable example I can find below. Click on the submit seems to work, but if you click on the 'Load File' button it freezes.
Can someone please help explain what I'm missing in my understanding of this framework?
import PySimpleGUI as sg
layout = [
[sg.Input(key='-FILENAME-', visible=False, enable_events=True), sg.FileBrowse('Load File')],
[sg.Submit(), sg.Cancel(), sg.Debug()],
[sg.Output(size=(88, 20))]
]
window = sg.Window('Debug Example', layout)
while True:
event, values = window.read()
print(event)
if event == '-FILENAME-':
print('File loaded')
elif event in (None, 'Exit', 'Cancel'):
break
window.close()