[Pythonmac-SIG] New to Python - how to get Py2App to work?
Christopher Barker
Chris.Barker at noaa.gov
Wed Jul 30 07:37:03 CEST 2008
Nehemiah Dacres wrote:
> for a gui app I would
> simply use platypus <http://www.sveinbjorn.org/platypus> and include
> what ever libraries I needed for the gui
It would be interesting for someone to do a comparison of Platypus and
py2app, but at a glance it looks like you'd need to do a lot of hand
work to include everything you need for your app with Platypus. Py2app
does all that for you -- at least most of the time!
Yes, those docs are a bit sparse, there was a better one somewhere, but
I can't find it at the moment. This doc from the pyObjC project may help.
http://pyobjc.sourceforge.net/documentation/pyobjc-core/tutorial/index.html
Here's the quick version:
1) you need to use the command line. If you've only ever run python
script from IDLE or something, it's time to fire up Terminal and learn a
bit about the command line.
2) You need a setup.py file for your app. There is a way to
auto-generate a simple one that I forget at the moment, but the one in
the PyObjC tutorial is a fine start:
from distutils.core import setup
import py2app
datafiles = [] # I'm keeping this here, as it will be handy later.
setup(
app=['TheNameOfYOurMainScript.py'],
data_files=[],
)
It's that simple (for the simple case!)
To run it, type:
$ python setup.py py2app
at the command line in the same dir as the setup.py file and your main
script. It should build an app bundle and put it in the "dist" folder
that it creates.
Once you've got that, I'd search the web and the archives of this list
for examples of more complex apps -- adding application icon, etc.
Also, I think there are some examples distributed with Py2app.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
More information about the Pythonmac-SIG
mailing list