[PyQt] GUI documenting

FT2 ft2wikipedia.inbox at googlemail.com
Fri Jan 22 17:34:48 GMT 2010


I'm hoping to document the GUI widget instances currently in use in an
application. Ideally I'd like a function that returns (widget,
parent), (widget, parent)...

The aim is to create a documentor for the GUI setup as it exists at a
given time. The main window will have a function that when triggered,
creates a text file documenting the whole GUI setup at that moment.


QDIALOG 1 AND ITS PROPERTIES
  |
  | ----- QTABWIDGET 1 AND ITS PROPERTIES
  |                  |
  |                  | ----- QWIDGET 1 AND ITS PROPERTIES
  |                  |                            |
  |                  |                            | ----- QCHECKBOX 1
AND ITS PROPERTIES
  |                  |                            |
  |                  |                            | ----- QPUSHBUTTON
1 AND ITS PROPERTIES
  |                  |
  |                  | ----- QWIDGET 2 AND ITS PROPERTIES
  |                                               |
  |                                               | ----- QLISTWIDGET
1 AND ITS PROPERTIES
  |
  | ----- QPUSHBUTTON 2 AND ITS PROPERTIES
  |
etc


Once a list of widgets exists, identifying the type and any properties
I'm interested in for each is fairly easy.

Does anyone have sample code how to generate a basic list of "created
widgets" in the first place? I can't find an example of this. In
principle it just needs to identify what objects have been created and
for each, its parent object. Presumably this needs basic knowledge of
the classes that hold information on objects created in the GUI, but
I'm not clear what those are or what a snippet for this would look
like.

Help appreciated :)

Thanks!


More information about the PyQt mailing list