PyQt5 – Getting the current index of selected item in ComboBox
In this article we will see how we can get the current index of the selected item the combo box. In order to do this we will use the currentIndex method.
Syntax : combo_box.currentIndex()
Argument : It takes no argument
Return : It return integer i.e index of selected item
Steps for implementation – 1. Create a combo box 2. Add items to combo box 3. Create push button 4. Add action to the push button 5. Create label to show count 5. Inside the action get the index of current item selected in combo box with the help of currentIndex method and store it in variable 6. Show the index in label with the help of setText method. Below is the implementation –