Home » Questions » Computers [ Ask a new question ]

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

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?"

Asked by: Guest | Views: 305
Total answers/comments: 4
Guest [Entry]

"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, 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.

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

Single executable (all platforms)

PyInstaller - the most active(Could also be used with PyQt)
fbs - if you chose Qt above

Single executable (Windows)

py2exe - used to be the most popular

Single executable (Linux)

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

Single executable (Mac)

py2app - again, works like py2exe but targets Mac OS"
Guest [Entry]

"Another system (not mentioned in the accepted answer yet) is PyInstaller, which worked for a PyQt project of mine when py2exe would not. I found it easier to use.

http://www.pyinstaller.org/

Pyinstaller is based on Gordon McMillan's Python Installer. Which is no longer available."
Guest [Entry]

An alternative tool to py2exe is bbfreeze which generates executables for windows and linux. It's newer than py2exe and handles eggs quite well. I've found it magically works better without configuration for a wide variety of applications.
Guest [Entry]

There's also PyGTK, which is basically a Python wrapper for the Gnome Toolkit. I've found it easier to wrap my mind around than Tkinter, coming from pretty much no knowledge of GUI programming previously. It works pretty well and has some good tutorials. Unfortunately there isn't an installer for Python 2.6 for Windows yet, and may not be for a while.