Ever wanted to compile your Python script or software into a MacOSX .app? I have tried Py2App and I never seemed to get it working properly. It would not import the modules I used in my application so upon launching it would give immediate error on the first imported module. I really wanted to compile my app for Mac as I had already successfully used Py2Exe to compile it for windows.
I stumbled upon Platypus which was made by Sveinbjorn Thordarson. Platypus interperetes several different languages and creates a native MacOSX application. It wraps the script in an application bundle along with a native executable binary that runs the script. Platypus supports several different languages other than Python like PHP, Perl, Expect, Ruby, Tcl, AppleScript, and some others. Checkout the homepage for Platypus and you can see the additional features.
I hope by showing you below how easy Platypus is to use, that everyone will give it a try. Its so simple. Just to show you how easy Platypus is to use:
1. Write a script.
For demo purposes I wrote a simple little gui that has a label on it using the Tkinter module.
2. Fire up Platypus.
3. Configure for compile.
- The application name
- Script type
- Script path
- Any extra configurable
Here is my configuration for the demo:
4. Add an icon
From the advanced menu, you can choose an image file you would like to use as the application icon.
5. Click “Create”
This will start compiling your .app.
6. Test your .app
Its just that simple! You now have a compiled .app for MacOSX in just 6 or so easy steps. Forget trying to figure out Py2App! Maybe someone can tell me how I can get my modules included when compiling with it. I tried modifying the spec file and adding the imports but that also was a no cigar