I heard GuineaPig said: > In my application I have a QDialog with a lot of QLabels. From time > to time these labels need to be cleared (text set to ''). Is there a > way to iterate over the labels ? > I'm looking for something like this: > > for QLabel in self.... > QLabel.setText('')
There is no direct way to do such a thing that I know of. However, you could easily code yourself a little function that would get your widget's subwidgets (with the .children() method) and filter out the non-QLabel ones: def getChildrenByType(obj, type): children = obj.children() isTypeSuitable = lambda child: child.isA(type) return filter(isTypeSuitable, children) for child in getChildrenByType(self, "QLabel"): child.setText('') -- S. _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde