PyQt5 QSpinBox – Getting current value
In this article we will see how we can get the current value of the spin box. By default its value is 0 although user can change it any time and programmatically we use
setValue method to change its value.
In order to get the value of spin box we use
Syntax : spin.value()
Argument : It takes no argument
Return : It returns integer i.e current value
Implementation steps –
1. Create a spin box widget
2. Create a label to show current value
3. Add action to the spin box
4. Inside the action get the current value with the help of
5. Show this value with the help of label.
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. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course