繁体   English   中英

将 combobox 上的选定项目连接到 pyqt5 中的一行

[英]Connecting selected item on combobox to a row in pyqt5

当在 combobox 中按下项目时,我想调用 csv 并检索在 combobox 中单击项目时匹配的行

class Ui_Dialog(object):
 def setupUi(self, Dialog):
    sales=pd.read_csv ("C:/Users/DELL/Desktop/Info/Topholdings/csv/Master_table.csv")
    sales_article = sales ["Company"] .dropna()
    sales_list = sales_article.values.tolist()
    self.Fundwise = QtWidgets.QComboBox(Dialog)
    self.Fundwise.setGeometry(QtCore.QRect(308, 141, 141, 61))
    self.Fundwise.setObjectName("sales_list")
    self.Fundwise.addItems(arr_list)

In the above code I call the csv file and select the first column as list which is displayed in the combobox,but when the user clicks one of the items in the combobox how to call the selected strings row

def setupUi(self, Dialog):
     #....
     self.Fundwise.activated.connect(self._set_fundwise)

def _set_fundwise(self):
    _data = self.Fundwise.currentData()
    if _data:
       #call selected strings

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM