In this article we will see how we can get the content of item at specific index in the combo box. In order to do this we will use the
Syntax : combo_box.itemText(index)
Argument : It takes integer as argument
Return : It return string i.e content of 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 content
5. Inside the action get the content of specific index in combo box with the help of itemIndex method and store it in variable
6. Show the content in label with the help of setText method.
Below is the implementation –
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.