PyQtGraph – Getting Font Metrics of the Image View
This article discusses how can we get font metrics of the image view object in PyQTGaph. In metal typesetting, a font has a particular size, weight and style of a typeface. Each font has a matched set of type and a typeface consisting of a range of fonts that shares an overall design. It can be set with the help of setFont method. Font metrics are the measurements of characters in a particular font, which allow you to evenly space and uniformly align lines of text.
PyQtGraph is a graphics and user interface Python library for functionalities commonly required in designing and science applications. Its provides fast, interactive graphics for displaying data (plots, video, etc.). Implements many features like displaying 2D and 3D image data. For 3D data, a z-axis slider is displayed allowing the user to select which frame will be displayed. Displays histogram of image data with movable region defining the dark/light levels and editable gradient provides a color lookup table for reference.
For creating an image view ImageView() is used
imv = pg.ImageView()
To get font metrics of the image view, fontMetrics() is used. It takes no arguments and returns a QFontMetrics object.
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