How to get background color of a dialog/window in RGB format?
Use QWidget::palette
to access widget's palette and QPalette::color
to obtain the background color:
color = widget.palette().color(QPalette.Background)
print color.red(), color.green(), color.blue()
http://qt-project.org/doc/qt-4.8/qwidget.html#palette-prop
http://qt-project.org/doc/qt-4.8/qpalette.html
http://qt-project.org/doc/qt-4.8/qpalette.html#ColorRole-enum
QPalette::Window - 10 - A general background color.
QPixmap::grabWindow();
can get you any part of the desktop.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With