PyQt5 QSpinBox - Adding border Last Updated : 17 May, 2020 Comments Improve Suggest changes Like Article Like Report In this article we will see how we can add border to the spin box, by default spin box has a black color border although we can change it below is how customized border looks like. In order to do this we have to change the style sheet code associated with the spin box, below is the stylesheet code QSpinBox { border : 5px solid blue; } Below is the implementation Python3 1== # 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, 250, 40) # setting prefix to spin self.spin.setPrefix("Prefix ") # setting suffix to spin self.spin.setSuffix(" Suffix") # setting style sheet to the spin box # adding border to the spin box self.spin.setStyleSheet("QSpinBox" "{" "border : 5px solid blue;" "}") # create pyqt5 app App = QApplication(sys.argv) # create the instance of our Window window = Window() # start the app sys.exit(App.exec()) Output : Comment More infoAdvertise with us Next Article PyQt5 QSpinBox - Adding border to the up button R rakshitarora Follow Improve Article Tags : Python Python-PyQt Python-gui Python PyQt-SpinBox Python PyQt-SpinBox-stylesheet +1 More Practice Tags : python Similar Reads PyQt5 QSpinBox - Adding border for anti hover In this article we will see how we can add border to the spin box for anti hover, by default spin box has a black color border which did not change when mouse hover over it or not although we can change it. Anti hover means customized border will be shown when cursor is not on the spin box. In order 2 min read PyQt5 QSpinBox - Adding background color In this article we will see how we can set background color to the spin box, by default the spin box is of white color although the button are of grey color but we can change the white color, below is how spin box with background color looks like In order to do this we have to change the style sheet 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 2 min read PyQt5 QSpinBox - Adding border to the up button In this article we will see how we can add border to the up button of spin box. Spin box consist of two buttons up and down, up button is used to increment the value, it has its own default border although we can change it. Below is how up button with customized border looks like. In order to do thi 2 min read PyQt5 QSpinBox - Adding border for anti pressed In this article we will see how we can add border to the spin box for anti pressed state, anti pressed state of spin box means when it is not pressed therefore customized border will appear when it is not pressed when it get pressed it will show its default border. In order to do this we have to cha 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 do 2 min read Like