Creating a Mac App File
As stated in the PySimpleGUI documentation, PyInstaller works like a charm. I would only add the --windowed option, so that PyInstaller builds an OS X .app bundle that doesn't open a terminal window. Otherwise, it works fine. Thanks!
edit: I finally had to ditch PyInstaller. The "application bundle" made by PyInstaller runs on the computer where you make it, but it doesn't work on other computers. I tried to look into it, but there seem to be tons of issues with MacOS and tkinter.
I switched to py2app, followed the tutorial, basically: py2applet --make-setup MyApplication.py and then python setup.py py2app and it just worked. I created the application bundle from a computer where I installed Python and Tcl/Tk via Homebrew.
Posted Jun 25, 2020, 3:57 AM UTC · edited
Thank you for the bit of extra info! I've included it for the next release of the readme. It's odd that the PC version doesn't create a console window while the Mac one does.
Have you looked at the PySimpleGUI-exe maker program that wraps the pyinstaller call into a PySimpleGUI based GUI? I'm wondering what it will produce when run on the Mac. I don't know if anyone's tried it before.
I tried it on Windows and it runs fine. On MacOS (High Sierra with Python 3.6.8 from python.org) I can choose the file, "Make the EXE" and it starts doing its job, but I get a PermissionError on the last lines and I don't get the App file.
In the output window, the first line should be the command that was executed. Does it look remotely correct.
Wondering if I should maybe add a check for the platform and perhaps change the command that is executed.
When you click the "Make EXE" button, this is what is executed:
It's interesting that instead of getting an exception it printed a permission error, presumably on the shutil.rmtree call.
Could be worth making changes to help Mac users if you think it'll work with a different command line.
This is my first time doing anything Python or PyInstaller related on MacOS, so I don't know if the command that is executed is ok. Anyway, the first line I get from pysimplegui-exemaker is:
If I don't use the pysimplegui-exemaker, but enter that same command in my terminal, it starts, but I end with the same PermissionError.
The command I use to successfully build an App file bundle is:
Thank you for providing a working command! That will give me something to work with.
I can add checkboxes / options to turn off the automatic cleanup. The idea was to make a GUI that would create an EXE file and then get rid of all the crap that's created in the process so that you're left with a single EXE file in the end.
[deleted]