Python and Qt

code, python, qt

With the Qt for Python announcement, it is hopefully going to be easier to develop Qt-gui’s for Python programs. I’ve written a Python-Gui once, and I used the included Tkinter, which was OK, but no more. First of all, there’s both an old and a new Tkinter included in Pythons standard library (why?). The newer version looks more native, but has a slightly different set of widgets, and in some cases worse (looking at you, slider!).

On the todo has been for a while a Python packaging tool, that would make it easy to both build and distribute Python-QT software: fbs. So far, I distributed only Windows version of that gui tool, and that by simply zipping up a full Python install, which is of course not great. I dicovered that both Qt for Python (or PySide2) and PyQt provide wheels, so you don’t have to build Qt yourself anymore when making your Python and Qt application, which is very nice. The size of those wheels are the bad news (~200 and ~100MB respectively), and I have not tried fbs yet but hope it removes the unused parts. Another tool that abstracts over both of these Qt bindings (allowing one to swap one in and the other out without changing a line of code) is the aptly named Qt.py.

Well, as you can see all this is a bit messy, and unless fbs removes unused components a bit harsh on the installation size (your Python application is probably far less than 1% of the total package size) . Hopefully Qt’s official support means it will improve the situation.