[PyKDE] Problem with QMultiLineEdit background color
stsao
stsao at eudoramail.com
Sat Nov 24 19:28:25 GMT 2001
When I run the following code, I found the following problem:
When the window is partially covered by another window, and then uncovered,
the part that was covered is not painted with the correct background
color. This behavior is not observed with the same code but using C++
instead of Python.
This occurs with both PyQT 2.5 and PyQt 3.0.
I am running Python 2.0 on Windows 2000 and PyQT was build using VC++ 6.0.
Can someone confirm that this indeed a problem and not just a local built
error?
Thanks
Sheng-Te Tsao
========================================================
from qt import QApplication, Qt, QObject, SLOT, SIGNAL, PYSIGNAL
from qt import QMultiLineEdit, QColor, QColorGroup
class MyMultiLineEdit(QMultiLineEdit):
def __init__(self, parent = None, name = None):
QMultiLineEdit.__init__(self, parent, name)
self.setWordWrap(QMultiLineEdit.WidgetWidth)
self.setWrapPolicy(QMultiLineEdit.AtWhiteSpace)
self.setUndoEnabled(true) # QWidget
self.setUndoDepth(8)
def setBackgroundColor(self, qColor):
palette = self.palette()
palette.setColor(QColorGroup.Base, qColor)
self.setPalette(palette)
if __name__ == "__main__":
import sys
def main(argv):
app = QApplication(argv)
mainWidget = MyMultiLineEdit()
mainWidget.setBackgroundColor(QColor(0xa0, 0xa0, 0xa0))
app.setMainWidget(mainWidget)
mainWidget.resize(500, 300)
mainWidget.move(100, 200)
mainWidget.show()
app.exec_loop()
main(sys.argv)
Sheng-Te Tsao
Online Status:
<http://eudora.voicecontact.com/vc3/?tst%40eudoramail.com><http://eudora.voicecontact.com/vc3/?tst%40eudoramail.com><http://www.eudora.com/products/voicecontact/>
More information about the PyQt
mailing list