In this article, we will see how we can add different padding size at different edges. Below is a image of label with normal padding and a label with different padding size at different edge.
In order to do this we will use
setStyleSheet() method and describe padding length for each edge.
Syntax :label.setStyleSheet("border :3px solid black;" "padding-top : 20px;" "padding-left:30px;" "padding-right:10;" "padding-bottom :5px;")
Argument : It takes string as argument.
Action performed : It will add padding to respective edges with respective lengths.
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.