In this article we will see how we can check if user can change the spin box value using key board or not, when we create a spin box there are basically two ways to change the value of the spin box one is by using arrow buttons or other way is using key board. We can stop keyboard input of spin box using
setReadOnly method with its line edit object.
In order to check this we use isReadOnly method with the line edit object
Syntax : line_edit.isReadOnly()
Argument : It takes no argument
Return: It returns bool
In order to do this we have to do the following :
1. Create a main window
2. Create a spin box
3. Get the line edit object from the spin box
5. Create a label to show result
6. Check if line edit is read only or not
7. Show check value on screen through 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