Open In App

PyQt5 QSpinBox – Removing the arrow buttons

Last Updated : 06 May, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

In this article we will see how we can remove the buttons of the spin box, basically there are two buttons in the spin box one for incrementing the value and second for decrementing the value. Below is the representation of how normal spin box looks like vs the spin box with no buttons looks like

In order to do this we will use setButtonSymbols method.

Syntax :
spin_box.setButtonSymbols(QAbstractSpinBox.NoButtons)
or
spin_box.setButtonSymbols(2)

Argument : It takes either QAbstractSpinBox object or integer value

Return : None

Below is the implementation




# importing libraries
from PyQt5.QtWidgets import * 
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import * 
from PyQt5.QtCore import * 
import sys
  
  
class Window(QMainWindow):
  
    def __init__(self):
        super().__init__()
  
        # setting title
        self.setWindowTitle("Python ")
  
        # setting geometry
        self.setGeometry(100, 100, 600, 400)
  
        # calling method
        self.UiComponents()
  
        # showing all the widgets
        self.show()
  
    # method for widgets
    def UiComponents(self):
  
        # creating spin box
        self.spin = QSpinBox(self)
  
        # setting geometry to spin box
        self.spin.setGeometry(100, 100, 150, 40)
  
        # removing the buttons
        self.spin.setButtonSymbols(QAbstractSpinBox.NoButtons)
          
  
  
# create pyqt5 app
App = QApplication(sys.argv)
  
# create the instance of our Window
window = Window()
  
# start the app
sys.exit(App.exec())


Output :



Similar Reads

PyQt5 QSpinBox - Checking if the arrow buttons are removed or not
In this article we will see how we can check if the spin box arrow buttons are removed or not, basically there are two buttons in the spin box one for incrementing the value and second for decrementing the value. In order to remove the buttons we use setButtonSymbols method. In order to check we will use buttonSymbols method. Syntax : spin_box.butt
2 min read
PyQt5 QDateEdit - Making Arrow buttons to left side
In this article we will see how we can make arrow buttons to the left side of the date edit. By default when we create a date edit arrow buttons are at the right side although we can change it, by changing the layout direction it is the easiest way of doing this. In order to do this we use setLayoutDirection method with the QDateEdit object Syntax
1 min read
PyQt5 QSpinBox - Adding border to the up arrow when pressed
In this article we will see how we can add border to the up arrow when it get pressed, we know there exist two buttons up and down in spin box and up arrow is the internal part of the up button. Up arrow is the subset of up button and up button is sub set of spin box. By default there is no border to the up arrow although we can add it, customized
2 min read
PyQt5 QSpinBox - Adding border to the up arrow when mouse hover
In this article we will see how we can add border to the up arrow when mouse hover over it, we know there exist two buttons up and down in spin box and up arrow is the internal part of the up button. Up arrow is the subset of up button and up button is subset of spin box. By default there is no boroder to the up arrow although we can add it, custom
2 min read
PyQt5 QSpinBox - Adding border to the up arrow for unpressed state
In this article we will see how we can add border to the up arrow when it is in anti pressed state, we know there exist two buttons up and down in spin box and up arrow is the internal part of the up button. Up arrow is the subset of up button and up button is subset of spin box. By default there is no border to the up arrow although we can add it,
2 min read
PyQt5 QSpinBox - Adding border to the up arrow
In this article we will see how we can add border to the up arrow, we know there exist two buttons up and down in spin box and up arrow is the internal part of the up button. Up arrow is the subset of up button and up button is subset of spin box. By default there is no border to the up arrow, below is the representation of how border to the up arr
2 min read
PyQt5 QSpinBox – Adding border to the down arrow
In this article we will see how we can add border to the down arrow, we know there exist two buttons up and down in spin box and down arrow is the internal part of the down button. Down arrow is the subset of down button and down button is sub set of spin box. By default there is no border to the down arrow, below is the representation of how borde
2 min read
PyQt5 QSpinBox – Adding border to the down arrow when mouse hover over it
In this article we will see how we can add border to the down arrow when mouse hover over it, we know there exist two buttons up and down in spin box and down arrow is the internal part of the down button. Down arrow is the subset of down button and down button is subset of spin box. By default there is no border to the down arrow. Customized borde
2 min read
PyQt5 QSpinBox – Adding border to the down arrow when pressed
In this article we will see how we can add border to the down arrow when it get pressed, we know there exist two buttons up and down in spin box and down arrow is the internal part of the down button. Down arrow is the subset of down button and down button is sub set of spin box. By default there is no border to the down arrow. Customized border wi
2 min read
PyQt5 QSpinBox - Adding background color to the up arrow
In this article we will see how we can set background color to the up arrow of the spin box. Spin box is basically have three components one is the line edit other two are up and down button. Up arrow is the inner part of the up button, below is the representation of how background color to the up arrow looks like. In order to do this we have to ch
2 min read
Practice Tags :