Python 选择其他组合框/列表框项目时显示QMessageBox PyQT

Python 选择其他组合框/列表框项目时显示QMessageBox PyQT,python,pyqt,Python,Pyqt,我有一个组合框cbLayer和一个函数dou stuff,其形式如下: def do_stuff(item_selected_from_cbLayer): new_list = [] # do stuff based on item_selected_from_combobox and put the items in new_list return new_list QMessageBox.warning(self, "items: ", do_stuff(cb_se

我有一个组合框
cbLayer
和一个函数
dou stuff
,其形式如下:

def do_stuff(item_selected_from_cbLayer):
    new_list = []
    # do stuff based on item_selected_from_combobox and put the items in new_list
    return new_list
QMessageBox.warning(self, "items: ", do_stuff(cb_selected_item))
如何使
QMessageBox
在以以下形式选择不同项目时弹出:

def do_stuff(item_selected_from_cbLayer):
    new_list = []
    # do stuff based on item_selected_from_combobox and put the items in new_list
    return new_list
QMessageBox.warning(self, "items: ", do_stuff(cb_selected_item))

编写包含此代码的方法或函数,并将其附加到组合框信号:


我没试过,但这应该能让你开始。否则,请查看PyQt示例。

感谢您提供的代码,这是QObject.connect(self.cbLayer,SIGNAL(“currentIndexChanged(int)”),self.warn\n def do_stuff(self,item):\n QMessageBox.warning(self,str(item))的最终结果。请相应地更改您的代码好吗?