Distributing the Tkinter application

So, you have your new application ready and now you want to share it with the rest of the world. How do you do that?

Of course, you need Python installation for your program to run. Windows does not come with preinstalled Python. Most modern Linux distributions and Mac OS X come preinstalled with Python, but you don't just need any version of Python. You need a version of Python that is compatible with the version on which the program was originally written.

And then, if your program uses third-party modules, you need the appropriate module installed for the required Python version. Sure this is too much diversity to handle.

Fortunately, we have tools, such as Freeze tools, which allows us to distribute Python programs as standalone applications.

Given the diversity of platforms to be handled, there is a large number of Freeze tool options from which to choose. Therefore, a detailed discussion on any one of the tools is beyond the scope of this book.

We will list some of the most evolved freezing tools in the following sections. If you find a tool fitting into your distribution requirement, you can look at its documentation for more information.

py2exe

If you only need to distribute your Python application on Windows, py2exe is perhaps the most hardened tool. It converts Python programs into executable Windows programs that can run without requiring a Python installation. More information, a download link, and tutorials are available at http://www.py2exe.org/.

py2app

py2app performs the same tasks in Mac OS X that py2exe does for Windows. If you just need to distribute your Python application on Mac OS X, py2app is a time-tested tool. More information is available at http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html.

PyInstaller

PyInstaller has gained popularity as a freezing tool in the last few years partly because it supports a wide variety of platforms, such as Windows, Linux, Mac OS X, Solaris, and AIX.

In addition, executables created using PyInstaller are claimed to take less space than other freezing tools because it uses transparent compression. Another important feature of PyInstaller is its out of the box compatibility with a large number of third-party packages.

The full list of features, downloads, and documentation can be assessed at http://www.pyinstaller.org/.

Other Freezing Tools

Other freezing tool include:

  • Freeze: This tool ships with standard Python distribution. Freeze can be used to compile executables only on Unix systems. However, the program is overly simplistic, as it fails to handle even the common third-party libraries. More information is available at this link:

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

  • cx_Freeze: This tool is similar to py2exe and py2app, but claims to be portable across all platforms on which that Python itself works. More information is available at this link:

    http://cx-freeze.sourceforge.net/index.html

    Tip

    If you're distributing a small program, a freeze tool might be just what you need. However, if you have a large program, say, with lots of external third-party library dependencies or dependencies not supported by any existing freezing tool, your application might be the right candidate for bundling the Python interpreter with your application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.186.109