[PyQt] Re: coloring a QDialog
TP
paratribulations at free.fr
Thu Apr 9 15:00:02 BST 2009
Phil Thompson wrote:
> You can't update a palette in-situ, you need to call setPalette() with the
> modified palette.
Ok, thanks a lot. Like this, it works better:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
app = QApplication( sys.argv )
dialog = QDialog( )
pal = QPalette()
pal.setColor ( QPalette.Active, QPalette.Window, Qt.blue )
pal.setColor ( QPalette.Inactive, QPalette.Window, Qt.red )
pal.setColor ( QPalette.Active, QPalette.WindowText, Qt.green )
pal.setColor ( QPalette.Inactive, QPalette.WindowText, Qt.yellow )
dialog.setPalette( pal )
vbox = QVBoxLayout()
a = QLabel( "toto" )
a.setPalette( pal )
vbox.addWidget( a )
dialog.setLayout( vbox )
dialog.show()
app.exec_()
--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
More information about the PyQt
mailing list