I am quite new to PyQt. Does anyone tell me how to get the background color of a button or label (QPushButton, QLabel) in PyQt.
I am quite new to PyQt. Does anyone tell me how to get the background color of a button or label (QPushButton, QLabel) in PyQt.
Here is a sample code. This will help you.
QPushButton button1, button2;
button1.setStyleSheet("background-color:#ff0000;");//To get Background color
QColor color = button1.palette().button().color();//To set fetched color
button2.setStyleSheet("background-color:" + color.name() +";");