Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I convert my python script to a .app?

Tags:

python

macos

.app

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

like image 728
Shameer Avatar asked Oct 02 '11 03:10

Shameer


People also ask

Can we convert Python code to mobile app?

You can convert your Python Code to Android APK.


3 Answers

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.

like image 92
aus Avatar answered Sep 23 '22 21:09

aus


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.

like image 28
jdi Avatar answered Sep 21 '22 21:09

jdi


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.

like image 22
Jonathan Avatar answered Sep 23 '22 21:09

Jonathan