PyQt5 QSpinBox – Cleaning the text
In this article we will see how we can clean the text of the spin box, cleaning of the text means removing spacing and zeroes before any number as we know 001 is similar to the 1 therefore cleaning of text will remove the unwanted zeroes from the text.
In order to do this we use cleanText method.
Syntax : spin_box.cleanText()
Argument : It takes no argument
Action Performed : It cleans the text of spin box
Note : Prefix, suffix, or leading or trailing whitespace are excluded.
Implementation steps :
1. Create a main window
2. Create a spin box set its range prefix and suffix
3. Create a push button
4. Add action to the push button
5. Inside the action method call the cleanText method
Below is the implementation