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 : font_metrics.size(0, text)
Argument : It takes two argument one is the integer value which refer to the flags for example 0 represent single line text and second is the spin box text.
Return : It returns QSize object.
Below is the implementation
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course