I mentioned I used pyjamas for building my content aggregator UI. Now that the UI is built, and I’m happy with it, I feel more confident weighing in more strongly about pyjamas.
Pyjamas is awesome. There, I said it.
I’m not going to go deep into what pyjamas is: There are FAQs and tutorials for that on their website. I’ll concentrate on why I enjoyed using pyjamas over every other framework I looked at- including QT and wx, and I enjoyed it more than using WPF and WinForms with C#, too.
First, pyjamas is written well. It is based directly on Google Web Toolkit, and the generally well-written API works. It isn’t entirely ‘pythonic’, but I still prefer to it to what I’ve used of other frameworks. The event system is a little kludgey, but I haven’t had any problems with it, really. I generally knew what things did based on their name and how they would be done. It all worked as expected, with a clear API with a minimal amount of redundancy and confusion (consider how many properties in WinForms are tightly coupled and how frustrating they can be to use and configure because of that).
It is of a manageable size. I didn’t feel overwhelmed by new concepts and classes. It contains a manageable number of things and amount of code. I felt that after a few days, I had a really good grasp for what I was doing and what was available in pyjamas.
It is well documented. For two reasons: first, there are amazing examples. It speaks volumes about the team and language that such examples with relatively little documentation and comments can be so expressive and clear. Second, because it mirrors GWT so closely, you can basically use the GWT API documentation verbatim (and the demo materials and tutorials available). Once I cracked into the GWT docs and realized how close they were, I never really felt at a loss for information.
It didn’t require a designer. I’ve ranted previously about what I think visual UI designer tools are doing to our children. I never once felt the need to use a designer with pyjamas. All the subclassing and composition that served me well in WinForms was better and easier in pyjamas. All the layout just happened naturally and straightforwardly. It just made me happy.
It uses CSS. This is beautiful, really. The truth is, I don’t think I’ve ever seen one person really use the styling options available in any web framework. Styling is always done at the code level, even with XAML/QML- that is at the code level for me because there are so many fucking options and specifics, you need tool support or you’ll get something wrong (or forget lots of stuff). CSS is dead simple, well documented, and tool support is ubiquitous- PyCharm even has it built in. It was an absolute pleasure to perform the styling of my UI with CSS.
My entire UI, which is moderately complex, is less than 600 lines of Python. Some of that is because I can use lambdas like a champ ;), but mostly that’s because 1) python is compact, 2) no designer, and 3) pyjamas is simple and expressive, and 4) all styling and configuration is done in CSS, which is even more compact and straightforward. I’m beginning to cringe thinking about doing this type of thing in C#.
I wonder how my zealotry for moving to a JS/HTML application base would go over, and how it would work in context? Hmmm, that seems perfect for a future post!