我用self.ROW更改了self.CULOMN_5,但仍然是相同的错误,所以全部在CULOMN_5上
即时获取“ Ui_Form”对象没有属性“ CULOMN_5”错误
def double_table(self):
for currentItem in self.tableWidget.selectedItems():
self.CULOMN_5=currentItem.column()
self.ROW_5=currentItem.row()
#if u ckick on column (i,4) i want to get result
if (self.CULOMN_5==4):
self.l=self.tableWidget.item(self.ROW_5,2)
self.w=self.tableWidget.item(self.ROW_5,3)
self.l=self.l.text()
self.w=self.w.text()
##print(self.l,' ',self.w,' ',type(self.w),' ',type(self.l))
#Multiplication of two column at the same row
if (self.l!='' and self.l!=None and self.w!='' and self.w!=None):
self.m=float(self.l)*float(self.w)
self.tableWidget.setItem(self.ROW_5,4,QTableWidgetItem(str(self.m)))
else:
self.tableWidget.setItem(self.ROW_5,4,QTableWidgetItem("Error"))
else:
pass
我想在同一行上将两列相乘,并在该行的最后一列上显示结果