Search code examples
pythonuser-interfacedeploymenttkinterrelease-management

Create a directly-executable cross-platform GUI app using Python


Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux.

The problem being I have no idea where to start or how to write a GUI with it, can anybody shed some light on this and point me in the right direction please?


Solution

  • First you will need some GUI library with Python bindings and then (if you want) some program that will convert your python scripts into standalone executables.

    Cross-platform GUI libraries with Python bindings (Windows, Linux, Mac)

    Of course, there are many, but the most popular that I've seen in wild are:

    • Tkinter - based on Tk GUI toolkit.

      De-facto standard GUI library for python, free for commercial projects.

    • WxPython - based on WxWidgets.

      Popular, and free for commercial projects.

    • Qt using the PyQt bindings or Qt for Python.

      The former is not free for commercial projects. The latter is less mature, but can be used for free.

      Qt itself supposedly supports Android and iOS as well, but achiving same with it's bindings should be tricky.

    • Kivy written in Python for Python (update 2023).

      Supposedly supports Android and iOS as well.

    Note that users of WxWidgets (hence WxPython users), often need to use WxQt as well, because WxWidgets's own GUI is not yet at Qt's level (at time of writting).

    Complete list is at http://wiki.python.org/moin/GuiProgramming

    Stand-alone/ single executables

    For all platforms:

    • PyInstaller - The most active (which could also be used with PyQt)
    • fbs - if you chose Qt above (commercial, with free plan)

    For Windows:

    • py2exe - used to be the most popular

    For Linux:

    • Freeze - works the same way like py2exe but targets Linux platform

    For MacOS:

    • py2app - again, works like py2exe but targets Mac OS