I have a function that accepts pyqt combobox object and checks its current index.
def update_valpm(self,hp,pm):
print(hp.currentIndex())
if hp.currentIndex() != -1:
if self.vrating == "230" or self.vrating == "240":
vrating = "460"
else:
vrating = self.vrating
if len(hp.currentText()) != 0:
data = pd.read_csv("hp.csv", index_col = "HP")
df = data.loc[[float(hp.currentText())],[vrating]]
pm.setText(str(float(df.values)))
Now the problem is that if the currentIndex is equals to -1 it will execute the code below it when its not supposed to. Did I miss something? Suggestions will be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire