[PyQt] List of childrens in QDialog by name?

Sergio Daniel Gomez sergiogomez at tostado.com.ar
Thu Feb 26 14:09:47 GMT 2009


Sergio Daniel Gomez escribió:
> How can I access to children's attibutes of a QDialog?
> 
> dlgBuscar = QtGui.QDialog()
> dlgGui = Ui_Dialog() # Made with QtDesigner and pyuic4
> dlgGui.setupUi(dlgBuscar)
> 
> if dlgBuscar.exec_() == QtGui.QDialog.Accepted:
>     for child in dlgBuscar.children():
>         print child
> # Return the a object list, ok.
> 
>     print dlgBuscar.children()[1].text()
> #print the text in the QLineEdit, but access by index. I need access by 
> object name. How?
> 
> Thanks.
> 
> 
> Sergio D. Gómez
> 
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 

With

print dlgBuscar.findChildren(QtGui.QLineEdit, 'txtBuscar')[0].text()

Thanks!


More information about the PyQt mailing list