[PyQt] PyQt, QSVGWidget background color

Phil Thompson phil at riverbankcomputing.com
Tue Nov 4 21:18:05 GMT 2008


On Tue, 04 Nov 2008 14:32:10 -0500, Matt Smith <melkor at orangepalantir.org>
wrote:
> Okay, I made a graphing tool.  Works great, somebody suggested that the
> background should be white.  No problem...I took the widget,
> 
> widget.palette().background().setColor(QColor('white'))
> 
> and it turned white.  But that turned the background of every widget in
> the main window white too.  Is there a way to seperate this widget's
> palette from the main windows palette?
> 
> I am thinking of making a large filled square that takes up my whole svg
> image if I can't do it through qt.

Try...

pal = QPalette(widget.palette())
pal.setColor(QPalette.Window, QColor('white'))
widget.setPalette(pal)

Phil


More information about the PyQt mailing list