如何获取对话框/窗口的背景颜色? [英] How to get background color of a dialog/window?

查看:56
本文介绍了如何获取对话框/窗口的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取 RGB 格式的对话框/窗口的背景颜色?

How to get background color of a dialog/window in RGB format?

推荐答案

使用 QWidget::palette 访问小部件的调色板和 QPalette::color 获取背景颜色:

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()

这篇关于如何获取对话框/窗口的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆