
- PyQt - Home
- PyQt - Introduction
- PyQt - Environment
- PyQt - Hello World
- PyQt - Major Classes
- PyQt - Using Qt Designer
- PyQt - Meta Objects
- PyQt Signals & Slots
- PyQt - Signals and Slots
- PyQt - Support and Signals
- PyQt - Unbound and Bound Signals
- PyQt - New Signals with PyQtSignal
- PyQt - Connecting, Disconnecting, & Emitting Signals
- PyQt - Slot decorator
- PyQt - Slot Connection
- PyQt Layouts
- PyQt - Layout Management
- PyQt - QBoxLayout
- PyQt - QGridLayout
- PyQt - QFormLayout
- PyQt - QHBoxLayout
- PyQt - QVBoxLayout
- PyQt - QStackedLayout
- PyQt - QGraphicsGridLayout
- PyQt - QGraphicsAnchorLayout
- PyQt - QGraphicsLayout
- PyQt - QGraphicsLinearLayout
- PyQt Basic Widgets
- PyQt - Basic Widgets
- PyQt - Qlabel Widget
- PyQt - QLineEdit Widget
- PyQt - QPushButton Widget
- PyQt - QRadioButton Widget
- PyQt - QCheckBox Widget
- PyQt - QComboBox Widget
- PyQt - QSpinBox Widget
- PyQt - QMessageBox
- PyQt - QDialogButtonBox Widget
- PyQt - QFontComboBox Widget
- PyQt - QDoubleSpinBox Widget
- PyQt - QToolBox Widget
- PyQt - QMenuBar, QMenu & Qaction Widgets
- PyQt - QToolTip
- PyQt - QInputDialog Widget
- PyQt - QFontDialog Widget
- PyQt - QDialog Widget
- PyQt - QFileDialog Widget
- PyQt - QTab Widget
- PyQt - QSplitter Widget
- PyQt - QDock Widget
- PyQt - QStatusBar Widget
- PyQt - QTabBar
- PyQt - QList Widget
- PyQt - QScrollBar Widget
- PyQt - QProgressBar
- PyQt - QCalendar Widget
- PyQt - QMessageBox Widget
- PyQt - QPlainTextEdit
- PyQt - QDateEdit
- PyQt - QDateTimeEdit
- PyQt - QTimeEdit
- PyQt - QTextEdit
- PyQt - QTextBrowser
- PyQt - QScrollArea
- PyQt - Drag and Drop
- PyQt - Multiple Document Interface
- PyQt - QDialog Class
- PyQt Views
- PyQt - QColumnView
- PyQt - QTableView
- PyQt Drawing API
- PyQt - Drawing API
- PyQt - Drawing a Line
- PyQt - Drawing a Rectangle
- PyQt - Drawing a Triangle
- PyQt - Drawing a Circle
- PyQt - Drawing a Ellipse
- PyQt - Drawing a Polygon
- PyQt - Geometric Transformation
- PyQt - Drawing Effect
- PyQt Groups
- PyQt - QButtonGroup
- PyQt - QGroupBox
- PyQt Effects
- PyQt - Effects
- PyQt - Opacity Effect
- PyQt - QGraphicsBlur Effect
- PyQt - QGraphicsColorize Effect
- PyQt - QGraphicsDropShadow Effect
- PyQt Events
- PyQt - Event Handling
- PyQt - Drag & Drop Events
- PyQt - File Open Event
- PyQt - Action Event
- PyQt - Hide Event
- PyQt - Resize Event
- PyQt Database
- PyQt - Database Handling
- PyQt Essentials
- PyQt - BrushStyle Constants
- PyQt - QClipboard
- PyQt - QPixmap Class
- PyQt Useful Resources
- PyQt - Quick Guide
- PyQt - Useful Resources
- PyQt - Discussion
PyQt - QFontComboBox Widget
The QFontComboBox widget is combobox that is used to select font family in PyQt applications. It gives the user to choose from an alphabetically sorted list of font family names. Some font family names include Arial, Helvetica, and Times New Roman etc.
Inheritance
QFontComboBox class inherits its core functionality from QComboBox class which extracts its properties from QWidgets class.

Key features of QFontComboBox
- Font Family Selection − Using font family selection users can easily select font families from an alphabetized list presented within the combobox.
- Visual Representation − Font are displayed using their actual styles whenever possible which helps users in visually identifying their preferred font.
- Customization − We can filter fonts based on certain criteria like scalability and writing system.
- Integration − It is commonly integrated into toolbars alongside other font-related controls like font size selectors and style toggles.
Example 1: Basic QFontComboBox Implementation
In this example, a simple PyQt application is created with a single QFontComboBox widget added to the main window. Upon running the application, users can interactively select font families from the combobox.
Here, the initUI method initializes the user interface by setting up a QVBoxLayout to arrange widgets vertically, adding the QFontComboBox to the layout, and setting the window's title to 'Font Selector'. Finally, the application is executed using QApplication, displaying the window and handling events until the application exits.
import sys from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout, QFontComboBox class FontSelector(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): layout = QVBoxLayout() font_combo = QFontComboBox() layout.addWidget(font_combo) self.setLayout(layout) self.setWindowTitle('Font Selector') if __name__ == '__main__': app = QApplication(sys.argv) window = FontSelector() window.show() sys.exit(app.exec())
Output
The above code produces the following result −

Example 2: Filtering fonts with QFontComboBox
In the below example we will create a font selector which will show only the scalable fonts. When we select a font from the combobox, the label below it will update to show the selected font family.
In a FontSelector QWidget, a QVBoxLayout arranges widgets. A QFontComboBox, font_combo, displays only scalable fonts due to setFontFilters(). A QLabel, font_label, updates to show the selected font family via update_label() when the font selection changes.
import sys from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout, QFontComboBox, QLabel class FontSelector(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): layout = QVBoxLayout() # Create QFontComboBox font_combo = QFontComboBox() # Set font filters to show only scalable fonts font_combo.setFontFilters(QFontComboBox.FontFilter.ScalableFonts) # Create a label to display the selected font self.font_label = QLabel("Selected Font") # Connect fontChanged signal to update_label slot font_combo.currentFontChanged.connect(self.update_label) layout.addWidget(font_combo) layout.addWidget(self.font_label) self.setLayout(layout) self.setWindowTitle('Font Selector') def update_label(self, font): # Update the label text with the selected font family self.font_label.setText(f"Selected Font: {font.family()}") if __name__ == '__main__': app = QApplication(sys.argv) window = FontSelector() window.show() sys.exit(app.exec())
Output
The above code produces the following result −
