In this article we will see how we can add action to the combo box. Action is basically a method called by the combo box when it gets changes these changes can be new item get inserted by user or any item get selected by the user.
In order to do this we will use
Syntax : combo_box.activated.connect(self.do_something)
Argument : It takes method name which should get called as argument
Return : None
Below is the implementation
When we select any item this get printed
Something Something Something Something
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.
- PyQt5 – Adding action to ComboBox with checkable items
- PyQt5 QSpinBox – Adding action when object name changed
- PyQt5 - Adding action to Radio Button
- PyQt5 QSpinBox - Adding action
- PytQt5 - Adding action to Check Box
- PyQt5 - Adding multiple items at given index in ComboBox
- PyQt5 - Adding item at given index in ComboBox
- PyQt5 - Adding border to the editable ComboBox
- PyQt5 - Adding border to OFF state ComboBox
- PyQt5 - Adding border to OFF state ComboBox when mouse hover
- PyQt5 – Adding border to non-editable ComboBox when mouse hover
- PyQt5 - Adding border to editable off state ComboBox
- PyQt5 - Adding border to non-editable off state ComboBox
- PyQt5 - Adding border to non-editable off state ComboBox when mouse hover
- PyQt5 - Adding border to non-editable offstate ComboBox when pressed
- PyQt5 - Adding border to non-editable ComboBox
- PyQt5 - Adding border to lineedit part of non-editable combobox when mouse hover
- PyQt5 – How to add action to a button ?
- PyQt5 QSpinBox - Getting the object by which action is called
- PyQt5 QCalendarWidget - Setting Action Event
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.