[PyQt] Log viewer

Frédéric frederic.mantegazza at gbiloba.org
Fri Jan 16 13:34:23 GMT 2009


I'm using the python logging module to log everything. I would like to
make a log viewer in my Qt application. This viewer can be opened from a
menu, and is modal.

I already did such viewer in gtk, using a textView/textBuffer. I created
a class from textBuffer, and I added write() and flush() method, so I
can give this object to the logging module as a handler. Then, when I
want to display the logs, I just create the textView, set its internal
buffer to the one I gave to logging, and so the logs appear.

I would like to do the same in Qt, but I don't know how. I found a
QTextDocument class, which sems to be the same as gtk textBuffer, but it
does not have a appendText or appendHtml methods, nor a way to limit the
number of entries.

Any idea how I can do that?

--
   Frédéric



More information about the PyQt mailing list