This article mainly introduces the combo box that you must learn every day in PyQt5. It has a certain reference value. Interested friends can refer to it.
QComboBox is a tool that allows users to select from a list of options. A control that selects an item.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
There are five options in the combo box. The label control is used to display the selected option from the combo box.
1 2 3 4 5 6 |
|
We create a QComboBox widget containing five options.
1 |
|
When the item is selected in QComboBox, we call the onActivated() method.
1 2 3 |
|
In the onActivated() method, we set the label control to display the text of the selected item. adjustSize() adjusts the size of the label.
After the program is executed
Related recommendations:
##PyQt5 The slider control QSlider_python## that must be learned every day
#PyQt4 implements a drop-down menu to select and print outPyQt5 must learn the switch button every day_pythonThe above is the detailed content of Combo box that you must learn every day in PyQt5. For more information, please follow other related articles on the PHP Chinese website!