You can have a listbox, selectbox or combobox with QComboBox. To use this widget, import QComboBox from PyQt5.QtWidgets.
Typically you’d see this widget when a user needs to choose from a select number of items, like country or contract.
Related Course: Create GUI Apps with Python PyQt5
You can create a list box with these lines:
combo = QComboBox(self)
The method addItem adds an option to the list box. You can call that as many times as you need to with different options.
To connect a listbox change with a method, you can use this:
The code below adds a combobox to a window. Once you select one of the options presented in the combo box, the label values changes.
If you are new to Python PyQt, then I highly recommend this book.