Developing cross platform desktop applications

Right from the beginning of my interest in programming; I’ve always had a thing for developing apps. Apps in the classic sense; the ones with a lot of bells and whistles that used to dominate the Windows landscape of yesteryears; the same ones usability experts would now cringe on looking at. That was probably because of the way I was introduced into programming. Starting with the good old QBasic; then moving on to Visual Basic – the only language where even your grandma could build an app in minutes. I was a tiny bit succesful too. I had this simple application called e-Diary which was basically just what its name stated. At its peak it had around 50-60 downloads a day and around 15k users who had registered via email to me. I’m still proud of that minor achievement; even though e-Diary has now vanished without a trace mainly due to my lack of interest in maintaining it; and the fact that all VB6 apps crash on modern versions of Windows :)

After all these years; after working on embedded devices and the web; I finally got a chance to build a real app on the desktop. Despite my long standing interest in this field; I was totally lost. The whole landscape was now very different – and I to spend a few days researching what works and what doesn’t.

I ended up choosing Python, Qt and the PySide python bindings for Qt. Why?

  1. I prefer working on Linux; my target was however Windows. The gamble on Python and Qt to be truly cross-platform as they both claimed. Paid off!
  2. My C++ days are long gone; I don’t think I can write 5 lines of good code in C++ anymore. Next choice was Java; but I was just a bit scared of over-engineering if I started with Java. So the natural choice was Python; even though I was not yet proficient in it.
  3. Next question was which GUI framework to go for. I saw Qt and to be honest I fell for it at first sight. It had everything I had dreamed of during my VB6 days.
  4. PySide vs PyQt was the next question. The product had a commercial angle to it; PyQt seemed more mature but had the GPL restriction or pay a very hefty licensing fee for a commercial app – so again was left with the Nokia supported PySide. Worked for me.

So that was it. I developed it completely on Linux. Since I am an IDE person; I opted for Eclipse with the Aptana Python plugin. After making sure it worked well in Linux; the next step was packaging it for Windows.

Now this was a challenge. The app required a Python install (15 MB) and a PySide install, including the Qt Libs (around 25 MB). This meant a total weight of 40 MB; for my app code that ran into just a few hundred kBs. Plus the ugliness of using consoles and shortcuts to run the application using python. Well, the perfect solution for that was PyInstaller. It worked like a charm and I was left with an exe file and only the absolutely necessary python modules that were needed. Running it through UPX futher reduced sizes and my whole app along with the libraries were now a saner 7 MB.

Next I ran them through the excellent InnoSetup tool; to create a Windows installer wizard that everybody is familiar with and the product was ready to be shipped.

Sun’s Oracle’s VirtualBox avoided the clumsiness of rebooting into Windows to do all the above; I just ran Windows on my Ubuntu installation as a virtual machine.

All this was surprisingly easy; just needed some figuring out initially. But once you get the hang of it; developing cross platform applications (at zero cost) is surprisingly easy. All tools I’ve used for this (except for Windows off course) are free and open source software.

So what are you waiting for? Start with those application ideas that you all have! It’s still fun!

Previous post
2010 : Reflections
Next post
Anna Hazare, Lokpal and the trendy Indian youth