PyQt5 QDoubleSpinBox – Setting Stylesheet Last Updated : 03 Nov, 2022 Comments Improve Suggest changes Like Article Like Report In this article we will see how we can set stylesheet to the QDoubleSpinBox. Stylesheet is used to set color, background and various styling things of the double spin box. With style sheet we can add border to it and make our own customized double spin box. In order to do this we will use setStyleSheet method with the double spin box object. Syntax : dd_spin.setStyleSheet(code) Argument : It takes string as argument Return : It returns None Below is the example style sheet code QDoubleSpinBox { border : 2px solid black; background : white; } QDoubleSpinBox::hover { border : 2px solid green; background : lightgreen; } QDoubleSpinBox::up-arrow { border : 1px solid black; background : blue; } QDoubleSpinBox::down-arrow { border : 1px solid black; background : red; } Below is the implementation Python3 # 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, 500, 400) # calling method self.UiComponents() # showing all the widgets self.show() # method for components def UiComponents(self): # creating double spin box d_spin = QDoubleSpinBox(self) # setting geometry to the double spin box d_spin.setGeometry(100, 100, 150, 40) # setting decimal precision d_spin.setDecimals(1) # step type step_type = QAbstractSpinBox.AdaptiveDecimalStepType # adaptive step type d_spin.setStepType(step_type) # setting style sheet to the double spin box d_spin.setStyleSheet("QDoubleSpinBox" "{" "border : 2px solid black;" "background : white;" "}" "QDoubleSpinBox::hover" "{" "border : 2px solid green;" "background : lightgreen;" "}" "QDoubleSpinBox::up-arrow" "{" "border : 1px solid black;" "background : blue;" "}" "QDoubleSpinBox::down-arrow" "{" "border : 1px solid black;" "background : red;" "}" ) # creating a label label = QLabel("GeeksforGeeks", self) # setting geometry to the label label.setGeometry(100, 200, 300, 80) # making label multi line label.setWordWrap(True) # 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 - Setting style to text R rakshitarora Follow Improve Article Tags : Python Python-PyQt Python-gui Python PyQt-QDoubleSpinBox Practice Tags : python Similar Reads PyQt5 QSpinBox - Setting style to text In this article we will see how we can set or change the style to the spin box text, setting style means setting some property to it, spin box has many styles available for its text for example StyleOblique, StyleNormal and StyleItalic by default it is style is set to the StyleNormal style. In order 2 min read PyQt5 QSpinBox - Setting Style Hint In this article we will see how we can set the style hint of the spin box text. Style hints are used by the font matching algorithm to find an appropriate default family if a selected font family is not available. There are many styles hints offered by the spin box like AnyStyle, SansSerif, Times et 2 min read PyQt5 QDoubleSpinBox â Getting Stylesheet of it In this article we will see how we can get the stylesheet of the QDoubleSpinBox. Stylesheet is used to set color, background and various styling things of the double spin box. With style sheet we can add border to it and make our own customized double spin box. It can be set to the double spin box w 2 min read PyQt5 QScrollBar â Setting Style Sheet In this article we will see how we can set style sheet to the QScrollBar. QScrollBar is a control that enables the user to access parts of a document that is larger than the widget used to display it. Slider is the scroll-able object inside the bar. Style sheet is the properties which are used to ma 2 min read PyQt5 QDockWidget â Setting Style Sheet In this article we will see how we can set style sheet to the QDockWidget. QDockWidget provides the concept of dock widgets, also know as tool palettes or utility windows. Dock windows are secondary windows placed in the dock widget area around the central widget in a QMainWindow(original window). S 2 min read PyQt5 QColorDialog - Setting Skin In this article we will see how we can set skin to the QColorDialog. QColorDialog is the pop up type widget in the PyQt5 used for selecting and creating colors. Color dialog is a huge widget that consists of lots of child widgets so it become tough to set stylesheet to the color dialog as it is a co 2 min read Like