Can I convert my python script to a .app?
Asked Answered
B

3

5

Is it possible to convert my .py script to a .app that works through a text box or something? Thanks

Bimetallic answered 2/10, 2011 at 3:35 Comment(3)
Question is pretty vague. But look at: PyObjC, maybe that's what your looking for?Cricoid
Are you asking for two separate things actually? 1) You want to be able to launch your python script graphically via a .app 2) You want some form of a GUI interface, such as a text box to interact with your script?Cordula
a text box to interact with but u can launch a .appBimetallic
I
6

Try py2app.

py2app is a Python setuptools command which will allow you to make standalone application bundles and plugins from Python scripts. py2app is similar in purpose and design to py2exe for Windows.

Incinerator answered 2/10, 2011 at 3:38 Comment(2)
You'll have to be more specific. This is definitely what you are looking for. Perhaps, open a new question detailing the problem you are running into.Incinerator
While I +1 the recommendation of py2app, I am guessing it only solves half of what he is asking. You also want some form of a Gui ("through a text box or something?"). While py2app will be able to create an .app that can be launched graphically, it will not provide you with any interface. It will simply launch your script. If your script is purely command-line, then you will see no visual output, aside from what gets logged to the console via print statements.Cordula
C
4

Because this is a vague question, I will provide a general answer. You need to decide on a GUI framework. There are a number of them to choose from.

PyQt4

http://qt.nokia.com/products/

http://www.riverbankcomputing.co.uk/software/pyqt/download

PySide (LGPL version of PyQt4) - http://www.pyside.org/

GTK - http://www.pygtk.org/

wxPython - http://www.wxpython.org/

TkInter http://wiki.python.org/moin/TkInter

You could even write a web interface that communicates with your python script via RPC or an HTTP rest interface. Take your pick!

My vote is on PySide/PyQt. Its very flexible and easy to use. At that point you would then use something like py2app to package up the entire environment into a standalone .app that can be distributed.

Cordula answered 7/11, 2011 at 17:43 Comment(0)
S
3

You can also use the cross-platform pyinstaller, which is more modern and I've had a good experience with.

sudo pip install pyinstaller
pyinstaller myprogram.py --windowed

There's a lot more configuration if you want to go cross platform, but this may get you started: http://pythonhosted.org/PyInstaller/#building-mac-os-x-app-bundles

This creates the distrutable. From there I use things like Inno Setup on windows or app2dmg for mac.

Sachsen answered 4/11, 2015 at 1:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.