In this article we will see how we can set or change the bottom margin of the spin box, by default there is no margin set the to the spin box i.e bottom margin value is zero. Although we can change that, setting margin to the spin box will not display any change in the spin box due to overriding take place by the widget to maintain its structure. But in order to set margin to the spin box we have set margin to the spin box’s line edit object by which we can display the margin in spin box.
In order to do this we use setBottom method.
Syntax : margin.setBottom(n)
Here margin is the QMargin object of the QLineEdit object which belongs to spin box
Argument : It take integer as argument
Return : It returns None
Implementation steps :
1. Create a spin box
2. Get the line edit object of the spin box
3. Get the margin object from the spin box
4. Set the bottom margin to the spin box
5. Add this margin object back to the line edit object
Below is the implementation
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.