<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Sans Serif'; font-size:13pt; font-weight:400; font-style:normal;">在 星期四 07 五月 2009 23:32:26,Lukas Hetzenecker 写道:<br>
> Hello,<br>
><br>
> you could redirect the interpreter’s standard error output stream:<br>
> sys.stderr = YourClass(window.edit, sys.__stderr__, QColor(Qt.red))<br>
> YourClass in an "file-like" object (it has an write function)<br>
> window.edit is an instance of Qt's QTextEdit class and is used to display<br>
> the message.<br>
><br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>It seems this is a Really good idea! But what if I want to write messages to the original stderr(i.e, to the terminal)?<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>-- <br>
Cheers,<br>
Grissiom</p></body></html>