In PyCon UK, the two keynote speakers, Mark Shuttleworth and Ted Leung raised the issue of how Python should "open up" and aim to be the best language at everything (Mark's point) and the easiest language to work with (Ted's point). I agree with both them, I was nodding all the time when they spoke. They focused on the web and on the desktop, respectively.
Here are my thoughts on the state of GUI toolkits and how could Python take a first step to be on the web.
I think it was Ted that pointed out that there are no good cross-platform GUI toolkits. He is a good authority on this matter, seeing that he was part of the Chandler project, that aimed to be cross platform from day one. I remember him saying:
There's something very wrong if the ugliest version of your product is the Mac version.
(Sorry if I misquote - just my memories!)
I couldn't agree more. There is no way right now to create state-of-the-art GUI application that runs on two platforms without writing the GUI twice. By "state-of-the-art" I mean, as Ted said, that this application should integrate so well in your desktop experience that given the choice to switch to a web application, you would deny!
This means that a user, when first launching your application, shouldn't notice anything. It should be seamless, look just right and more importantly, behave right. Of course it is the Mac users that complain about this so loudly, because the Mac platform gives you a wide variety of built-in behaviours that your application can use that when people roll their own, it looks weird. Look at the recent example of Firefox 3, that took great pains to look as a native application, and you still can't look up words in the dictionary!.
No wonder that people are turning to web applications. They can use them from both their home and their office, they look exactly the same and of course they have the added benefit of safekeeping all their data for them.
There are a couple of cross-platform GUI toolkits with Python bindings, such as PyQt4 and wxPython, but you could hardly call their API Pythonic or even simple. I've looked at tutorials and while at the beginning they look promising, at some point things get so hairy that I recoil in horror (in PyQT it was signals - why couldn't I use just a function?). In all fairness, I'm sure you can build good applications with them if you try hard, but it's not as easy as using the native API (.NET or Cocoa).
Now, I'm a Mac user for the past year, and of course I had to dabble with Cocoa, and I liked what I saw. An excellent visual designer, a dynamic language (even with an alien to me syntax), very elegant architecture (outlets and actions make for excellent encapsulation) and batteries included.
I was pleasantly surprised for the past 6 months about .NET, it has a sane API (although I don't like generated code), a rich set of libraries and of course the killer feature for me was that I didn't have to use C#, since IronPython has a seamless integration with it. I have a few peeves, but they are related more to Windows itself rather than .NET (can we get a standard way of displaying modal dialogs please?)
It seems like you have to be knowledgeable about your target platform to know how your application can integrate into it, so no framework can give you that. But the rest of the things you want to do, like buttons and windows and all sorts of widgets, are almost the same. I had an idea about how you could translate a GUI definition (in XML or Python) into multiple platforms. Interface Builder generates (as of Leopard) XML output, so you can start from there as a base and try to generate .NET code to build something similar. Unfortunately I had a look at the output of IB and it is a serialized object graph that looks too opaque to be of great use, but I still think that the idea could yield something. My feeling is that approach like this would have to be constrained and not aim to be the last toolkit you'll ever need. Perhaps the other way round (a translation of Python code to native widgets) would be interesting to try out as well.
The main point of the previous paragraph was to stop trying to reinvent the wheel and try to reuse tools and technologies that are already there. I'm not sure if the specific approach would work, but I think that there is an example of something like that that worked very well indeed.
I think that these libraries will gain traction when people want to build web applications, but the point I want to make is that they didn't have to design another big API, they took something that was proven (Cocoa) and brought its ideas into the web. The fact that Objective-J can fool the untrained eye into believing it is Objective-C is irrelevant, although I think that even with a different syntax, if the underlying values were the same it would've been the same.
This is why I think that people could start doing the same thing with Python, with a very big drawback: There is no big and proven GUI Python toolkit that you can port to the web, and I think that there will be none unless some very big company invests money into creating one. (Mr Shuttleworth, time to put your money where your mouth is :)
It is a big undertaking, but not an impossible one. I'll stop rambling now...
This post is older than 30 days and comments have been turned off.