I'm using the codes below in a run.py
file from PySimpleGUI cookbook for the GUI of my Python app. The GUI works normally when I started the run.py
file from PyCharms. However, when I build this into a one file, windowed app with PyInstaller, I get an app crashed error message everytime I close the app with the Exit button on the GUI. I tried to build the app as one file, console app and there wasn't any issue. Has anyone seen this problem before and how to resolve this issue?
def main():
sg.theme('Tan Blue')
layout = [
[sg.Text('Root Path:', size=(15, 1)), sg.InputText(root_path), sg.FolderBrowse()],
[sg.Text('Date:', size=(15, 1)), sg.InputText(datetime.today().strftime('%Y-%m-%d %H:%M:%S')),
sg.CalendarButton('Choose Date', target=(1, 1), key='date')],
[sg.Output(size=(80, 15), key = '_output_')],
[sg.Button('Run'), sg.Button('Exit'), sg.Button('Clear')]
]
window = sg.Window('App name', layout)
while True: # Event Loop
event, values = window.Read()
if event in (None, 'Exit'):
break
elif event == 'Run':
runScript(values)
window.Refresh()
if event == 'Clear':
window.FindElement('_output_').Update('')
window.close()
def runScript(values):
""" run shell command
@param cmd: command to execute
@param timeout: timeout for command execution
@param window: the PySimpleGUI window that the output is going to (needed to do refresh on)
@return: (return code from command, command output)
"""
### My app codes here
main()
I can't include the codes for my app. I use Numpy and Pandas in my codes. I'm listing the dependencies and versions I'm using below
altgraph==0.17
et-xmlfile==1.0.1
future==0.18.2
jdcal==1.4.1
numpy==1.18.4
openpyxl==3.0.3
pandas==1.0.4
pefile==2019.4.18
PyInstaller==3.6
PySimpleGUI==4.19.0
python-dateutil==2.8.1
pytz==2020.1
pywin32==227
pywin32-ctypes==0.2.0
six==1.15.0
xlrd==1.2.0