views:

139

answers:

6

I'm working on an application that I need to be cross-platform. I'd like to use Python for it, and am looking for GUI toolkits that make interface programming simple and easy. After a slight hunt, I found PythonCard. This looks like it fits the bill perfectly, but I'm not sure if it will be possible to compile this down to an appropriate executable for each operating system. I found these instructions, but they're 6 years old.

Whatever solution I choose must support the following:

  • Write one GUI to work on both Windows and Mac OSX
  • Must 'compile' into an easily distributable file for both windows/mac
  • Compiled file must not require Python to be installed on the users computer

Can anyone recommend a library/solution before I have to wade into the desolate world of Java?

+3  A: 

Use PyInstaller to distribute an app using PyQt or WxPython gui toolkits. From the website:

PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, and Mac OS X.

As for gui toolkits, PyInstaller is documented to work with Qt3, Qt4, and WxPython.

StackOverflow contributor dF, uses PyInstaller "for an app which depends on PyQt, PyQwt, numpy, scipy and a few more."

Steven Rumbalski
+1  A: 

I think the answer here is less about the particular GUI toolkit and more about distributing stand-alone python applications. Personally, I've found the tools for this a little less perfect than I'd like but, after some finagling, they get the job done. The most likely candidate that'd fit your needs is cx_Freeze. Though there's a Windows specific py2exe and Mac specific py2app that might fill the bill if cx_Freeze is insufficient.

Rakis
Have you tried cx_freeze? When we decided, which program to use, we faced some troubles while trying to pack python binding of our C++/Qt library into the final file.Maybe, we just doesn't tried hard enough, but Py2Exe was perfect and simple:)
Max
Honestly, no. I haven't. The handful of times I've needed to deploy a standalone python app has been on Windows only and for that I used py2exe. It was several years ago though and I haven't had cause to revisit the issue to see what's changed.
Rakis
A: 

Hmm.

Maybe it'd better to move my post to comments, but. Why do you want to 'compile' python code, and why do you think that some GUI framework should provide some packaging/installation facilities?

In our company we wrote cross-platform GUI app and of course we must make it easily deliverable for customers. So, we found suitable GUI framework with python bindings (Qt), then we chosen the method to hide unneeded details about realisation and vanish dependancies (Py2Exe for Windows, Py2App for Mac, and nothing for linux, but you can try PyInstaller or cx-freeze).

Installation for every OS made in that OS' way, according to the least astonishment principle. That's why we did not pack linux version in some kind of binary executables.

Max
A: 

If you want your application to look and feel native, then wxPython is the way to go. PyQt can look native, but it doesn't sound like it always behaves in a native way (according to some threads I've read). To build binaries, use py2exe or some such for Windows and py2app for Mac

Mike Driscoll
A: 

This presentation walks through the process and also winds up with Py2exe and Py2app...

Dave Everitt
A: 

For Wxpython GUI designers check this question. I breifly tried boa-contstructor but I found it too limiting -as not all widgets are supported. AFAIK none of the wxpython designers support all widgets (out of the box atleast).

I personally find it faster and easier to hand code my GUI's. Id say it only took me a few days to become reasonably comfortable/familar wxpython. If you need to do anything other then creating a simple application then taking a little bit of time to learn wxpython will pay its dividends.

If your bound to the idea of having a descent GUI designer then your best bet is probabaly PyQt as this IMHO is the only toolkit that has a solid mature editor -Qt Designer

As for creating standalone excutables Ive only used py2exe for windows. py2app does the same for mac although I have not tried that yet.

For windows installers checkout this thread

volting
Ah.. If it were some forum here, not SO.com... Another holywar Qt vs WxWidgets (and maybe handcode vs visual designers) would have been started:) But.
Max
well lucky its not some forum then as it was not my intention to start a holywar!, just to offer my humble opinion from personal experience.
volting