In this lesson we are going to learn How to Create ComboBox with Qt Designer & PyQt6, A combobox is a selection widget that displays the current item, and can pop up a list of selectable items. A combobox may be editable, allowing the user to modify each item in the list. in combobox also we have different methods like:
- setItemText() = sets or change the item text in the combobox
- removeItem() = remove the specific item from the combobox
- currentText() = it returns the current text from the combobox
- setEditable() = using this method we can make the combobox editable
- addItem() = using this method we can append a a new item in the combobox
- currentIndex() = returns the current index from the combobox
- count() = this method returns the items in the combobox
also there are some signals that you can use
- currentIndexChanged(): it is Emitted when the index of the combo box is changed
- editTextChanged(): it is Emitted when the text of an editable combo box is changed.
- How to Use Qt Designer in PyQt and PyQt6
- Build Text to Speech App with Python & PyQt5
- How to Build GUI Window in PyQt6
- How to Show Image in PyQt6
- How to Create Calendar with Python & PyQt6
- How to Create CheckBox with Qt Designer & PyQt6
First of all you need to open your Qt Designer, add QCheckBox with QLabel, after that save the ui file in your working directory.

This is the complete code for loading the UI file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from PyQt6.QtWidgets import QApplication, QWidget, QLabel, QComboBox from PyQt6 import uic class UI(QWidget): def __init__(self): super().__init__() # loading the ui file with uic module uic.loadUi("ComboDemo.ui", self) self.label_result = self.findChild(QLabel, "label_result") self.combo = self.findChild(QComboBox, "comboBox") # connected combobox signal self.combo.currentTextChanged.connect(self.combo_changed) def combo_changed(self): item = self.combo.currentText() self.label_result.setText("Your Account Type Is : " + item) app = QApplication([]) window = UI() window.show() app.exec() |
for loading the UI file we are going to use uic module and you need to give
the name of the ui file.
1 |
uic.loadUi("ComboDemo.ui", self) |
We can find the widgets of QLabel and QComboBox using the findChild() method, you need to pass the widget type and the object name.
1 2 3 |
self.label_result = self.findChild(QLabel, "label_result") self.combo = self.findChild(QComboBox, "comboBox") |
In here we have connected the currentTextChanged() signal with combo_changed() method.
1 |
self.combo.currentTextChanged.connect(self.combo_changed) |
This is the method or slot, in here first we get the value from the combobox and after that
we have set that in the label.
1 2 3 |
def combo_changed(self): item = self.combo.currentText() self.label_result.setText("Your Account Type Is : " + item) |
Run the complete code and this will be the result.
