簡體   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