While creating a Label in PyQt5, we can see that there is no background color. In this article we will see how to add background color to the Label.
In order to add border to the Label we will use
label.setStyleSheet() method, this will add the background color to the label, it is same like designing the CSS style sheet.
Syntax : label.setStyleSheet(“background-color: cyan”)
Argument : It takes string as argument.
Action performed: It changes the background color of the label.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course