Getting back into PyQt and not loving it.
torriem at gmail.com
Sun Jun 26 17:45:00 EDT 2016
I'm starting to question the advice I gave not long ago to for new users
to consider the Qt toolkit with Python.
I just did a little project porting a simple graphical user interface
from GTK+ to Qt (PyQt4 for now as that's what I have installed). For
the most part it worked out pretty well. It's been a while since I used
PyQt or PySide, and I had forgotten what a horrid Python experience Qt
really is, at least in PyQt4. Maybe the bindings for Qt5 are better...
I'll be working with them next as I convert my working code.
Qt's a fantastic toolkit, and the most mature of any of them, and the
most portable, but man the bindings are not Pythonic at all. PyQt does
not seem to hide the C++-isms at all from the programmer. I am
constantly wrapping things up in Qt classes like QRect, QPoint, QSize,
etc, when really a python Tuple would have sufficed. All the data
structures are wrapped in Qt C++ classes, so you end up writing what is
really idiomatic C++ code using Python syntax. Not the best way to code
Python! Implementing signals in a class, too, reminds you strongly that
you're working with C++ as you have to construct their method signatures
using types that map back into C++.
More information about the Python-list