PyQt5 QSpinBox - Getting base size Last Updated : 17 May, 2020 Comments Improve Suggest changes Like Article Like Report In this article we will see how we can set the base size to the spin box, base size is used to calculate a proper spin box size if the spin box defines sizeIncrement. By default, for a newly-created spin box, this property contains a size with zero width and height.In order to set base size we use setBaseSize method. In order to get base size we use baseSize method. Syntax : spin_box.baseSize() Argument : It takes no argument Return : It returns QSize object 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 base size self.spin.setBaseSize(250, 40) # creating a label label = QLabel(self) # setting geometry to the label label.setGeometry(100, 200, 300, 30) # getting the base size base = self.baseSize() # setting text to the label label.setText(str(base)) # 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 - Getting pixel size R rakshitarora Follow Improve Article Tags : Python Python-PyQt Python-gui Python PyQt-SpinBox Practice Tags : python Similar Reads PyQt5 QSpinBox - Getting the frame size In this article we will see how we can get the frame size of the spin box. Frame size is the spin box size relative to its parent including any window frame. By default, frame size of the spin box contains a value that depends on the user's platform and screen geometry. In order to do this we use fr 2 min read PyQt5 QSpinBox - Getting Point Size In this article we will see how we can get the point size of the text in spin box. Changing the point size will change the size of the text, pixel and point are two different things some point can have multiple pixels inside it. It is recommended to change point size for changing the size of the tex 2 min read PyQt5 QSpinBox - Getting pixel size In this article we will see how we can get the pixel size of the text in spin box. Pixel size change the size of each pixel of the text there more the value of pixel the more text will get enlarged. We can change the pixel size with the help of setPixelSize method. In order to do this we use pixelSi 2 min read PyQt5 QSpinBox - Getting current value In this article we will see how we can get the current value of the spin box. By default its value is 0 although user can change it any time and programmatically we use setValue method to change its value. In order to get the value of spin box we use value method Syntax : spin.value() Argument : It 2 min read PyQt5 QSpinBox - Setting base size In this article we will see how we can set the base size to the spin box, base size is used to calculate a proper spin box size if the spin box defines sizeIncrement. By default, for a newly-created spin box, this property contains a size with zero width and height. Below is the formula for getting 2 min read PyQt5 QSpinBox - Getting the size of the font In this article we will see how we can get size of the spin box's font i.e text. In order to get the size object we have to get the QFontMetrics object of the size box to get the size. The size will be in pixels. In order to do this we use size method with the spin box's QFontMetrics object. Syntax 2 min read Like