python & qt

I wanted to learn GUI programming in QT for a long time but never really found enough motivation and a good toy problem to start from. Finally the motivation presented itself as a more or less unconstrained task in one of the courses at school, called computer graphics. I decided to implement the IFS fractal generator that I once saw in The Computational Beauty of Nature . It’s really strange how couple of simple equations can generate such natural looking objects and they would look even more realistic just by adding some random.

Here are couple of screenshots from the application:

fern_colordepth

ifs31

QT turned out to be a really elegant library and it’s documentation in the form of qt-assistant was probably the best library documentation that I have ever seen. It is easily navigable and provided lots of good examples that helped a lot. For PyQt specific stuff I skimmed through Rapid GUI Programming with Python and Qt (seems to be a good book) and read some of the sources of the Eric IDE. Altogether it took about 5 working days to write this and most of the time was spent learning QT, so probably now it would take a lot less time, which is impressive considering it has several dialogs and runs rendering in a separate thread etc.

Best of all – things written this way are really portable [1] and will run just fine under linux, *bsd, Mac OS X, windows and several other operating systems. Anyway, here’s the source and you need to have PyQT installed in order to run it (python-qt4 package under debian/ubuntu linux).

1 – as opposed to MS style portable where it usually means you can get it running on other windows versions if you are lucky enough.

Leave a Reply

Your email address will not be published.


*