tags:

views:

287

answers:

6

Hi, I've written a Python GUI application and made it run on Linux, Windows and Mac.

The framework I'm using is PyGtk. The final result is not really good: the application looks horrible on Mac, and it is not really 'native' neither on Windows. Furthermore on Mac the windows' behavior is sometimes wrong, with modal dialogs appearing below the main windows.

I've explored other frameworks and I've found that a porting may be really hard:

  • PyQt it is huge, difficult to install and to distribute under Mac;
  • PyGui is poor: I need tables and tree views at least;
  • wxPython state explicitly that you have to use a custom python build for Mac
  • Tkinter: didn't check it, only have the impression that it is obsolete

I know this question may appear similar to http://stackoverflow.com/questions/394039/which-python-gui-framework but in that thread the portability issue is not really taken in account.

Windows and Mac are a must, since most of my user have that systems.

Can you also suggest some books?

+1  A: 

In my experience, GUI programming in Python for the Mac platform is never a happy experience. Admittedly, I've only worked with PyQT and PyGTK. Window behavior never seems right and the widgets don't work as expected. That said, here is a resource that lists, ad nauseum, GUI toolkits for Python and the respective platforms they target:

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

thetaiko
That page is not maintained: for example it says about PyGui that it does not support Windows, while it does.
Iacopo
@lacopo - perhaps not maintained well - however it is still a valid and useful resource and should provide a decent starting point for exploring possible solutions.
thetaiko
@lacopo: Standard Wiki argument applies. If you can see a mistake, go ahead and fix it.
Oddthinking
A: 

I don't think this is actually a Python question. You're dissatisfied with the cross-platform GUI toolkits themselves - there's nothing Python-y about what you've asked. Perhaps what you need to do is find a GUI toolkit you are satisfied with and then worry about how to wire your Python app to that.

The web has become the premiere metaplatform, right? Could you use an HTML / Javascript / Flash interface?

Something like this?

http://www.adobe.com/devnet/flex/articles/flex_ui_print.html or this?

http://pyjs.org/ (search for Pyjamas-Desktop when you get there)

gomad
Short of the fact that he's using python and therefore needs a toolkit that is supported by python. While flex and AIR is pretty cool and works fairly well cross platform (other than it's pretty heavy), I don't think that solves his problem.
MacAnthony
I've got a pretty functioning library that the application is wrapping. The library is quite pythonic, and I'd like not to change it; I want to extend and improve, not to rewrite from scratch. Working with the PyGTK was quick, and under Linux it did great. Otherwise I would have considered Java/Swing, too.
Iacopo
The flex article I linked to was about using Python in an Air interface, communicating over Python's dead-simple XMLRPC. The Pyjamas article is about running GWT-like apps on the desktop, in Python. I NEVER suggested that you change languages, I suggested that you change UI platforms from operating systems to browsers.
gomad
+2  A: 

The "Code once, run everywhere" quest is a bogus one, as far as GUIs are concerned. If you don't want a Mac version that looks & feels foreign and crappy, you're going to have to develop a separate GUI layer for it.

Virgil Dupras
A: 

Perhaps you provided the answer in your comment on my original answer:

Have you considered a Jython/Swing solution? Use Java for your GUI and your existing Python code for the logic?

gomad
A: 

Well, actually I tried a few solutions and I think I will proceed with wxPython.

There are some notable problems, first of all that I must use the old 2.5 Python. However I was able to create a portable .app directory for Mac and an auto-installing .exe for Windows (and a pair of Makefile(s) to create them).

The porting has not been initiated yet (real work and more pressing issues arrived :-( ).

Thanks to all who proposed alternative approaches, but some application-specific problems made these choices not really appealing.

  1. I want my application to use only one language/technology, for ease of maintenance and deployment, so hybrid Flash/Air etc. approaches were discarded.
  2. The application will work also offline, so no client/server approach available.
  3. Being wxPython not the most easy-to-use framework, I've worked with swing in the past, and had a really hard time. Maybe in the meantime more powerful tools are available, but I find wxGlade sufficient for my needs, furthermore the only-one-platform argument applies against using Java

However I had my views widened from all the replies. Thanks again

Iacopo
A: 

I must say I use PyQt for this. I develop for Linux, Windows and Mac OS X. And even though when I started, it was a pain to get it working on Mac OS X (mostly because I also need scipy), it is now much better and PyQt4 can be installed without problems. You just need to download the archives from www.riverbankcomputing.co.uk.

Also, another option is to include PyQt4 with your application and update the sys.path to point toward where PyQt4 is installed. That's what I am doing to ensure people don't need to install anything to use my application.

PierreBdR