In this article, we will see how to add padding to our Label. Padding is just the space between the border and the content. Below is image of label this will helps in better understanding of the padding.
In order to add padding to our label, we will use
setStyleSheet() method, below is how without padding label vs padded label looks like.
Syntax : label.setStyleSheet(“padding :15px”)
Argument : It takes string as argument.
Action performed : It adds padding to 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.