Summerfield "Quick GUI Programming with Python and Qt." I like the book as a whole. The first few chapters are the best Python primer I have found online anyway, and the examples are varied and useful (but not perfect, although some additions and re-checks can be much more direct).
My problem is that I feel that maybe I'm going to get rid of her bad habits. Instead of simply dynamically assigning new attributes to an existing object, the author uses the setData functions, special MIMEData slots and much more. Here is a good example from one of the first questions I asked in Stackoverflow:
Installing and retrieving data from PyQt widget elements?
or, for example, in a web designer application:
def writeItemToStream(self, stream, item): if isinstance(item, QGraphicsTextItem): stream << QString("Text") << item.pos() \ << item.matrix() << item.toPlainText() << item.font() elif isinstance(item, QGraphicsPixmapItem): stream << QString("Pixmap") << item.pos() \ << item.matrix() << item.pixmap() elif isinstance(item, BoxItem): stream << QString("Box") << item.pos() \ << item.matrix() << item.rect stream.writeInt16(item.style)
I correctly think that the author's background C ++ / Qt can make his examples suboptimal? Or should I continue to try to understand many of its options?
source share