How does one distribute Tkinter or Qt GUI apps Developed in Python

Oscar Benjamin oscar.j.benjamin at gmail.com
Thu Dec 17 10:30:02 EST 2015


On 17 December 2015 at 00:03, Bruce Whealton
<futurewavewebdevelopment at gmail.com> wrote:
> I watched one training video that discussed Python and Tkinter. Like many similar tutorials from online training sites, I was left scratching my head.
>
> What seems to be blatantly missing is how this would be distributed. In the first mentioned tutorial from Lynda.com the Tkinter app was related to a web page. However, the browser cannot run Python Bytecode or Python Scripts.
>
> Surely, one is going to want to create GUI apps for users that are not Python Developers. I would not think to ask someone to install Python on their system and make sure it is added to the path. Maybe it is not so hard for the non-technical, average users.
>
> I would want to package in some way so that when launched, it installs whatever is needed on the end user's computer. How is this done?
> Are there common practices for this?

There are different general approaches in this area. One possibility
is to ship an installer. Another is to try and ship a complete single
file executable. For the single-file executable you have
pyinstaller/py2exe/py2app etc.

If you're user can be expected to install the software before running
it then in the basic case it is not too hard. Python itself comes with
a graphical installer for Windows and is already installed on every
other OS. If you can assume that Python is installed then you can
distribute your application simply as a zip file but with a .py(z)(w)
file extension.

See here:
https://www.python.org/dev/peps/pep-0441/

A Windows user should then be able to simply double click the .pyz
file and have it run. I'm not sure how that works on a MAC but on
Linux you can preface the zip file with a shebang make it executable
and it will run from the terminal and from any file-browser if it
knows how to run executable files.

Another option for Windows although it is relatively new is that as of
Python 3.5 there is an embedded distribution of Python that is
intended to be shipped as part of an application installer and
installed local to the application. This is new and I haven't heard
anyone using it and don't know if any tools exist to help actually
creating an installer using it.

--
Oscar



More information about the Python-list mailing list