setText() and addItem() of lineEdit and QlistWidget respectively do not show the contents

37 Views Asked by At

I want to display the value stored in the varible "total" to the QlineEdit and add value of the variable 'points' to the QlistWidget when the button is clicked.

In the following block of code, i used "self.lineEdit.setText(str(points))" and "self.LW2.addItem(self.points)" to set text to QlineEdit and QlistWidget respectively. Still, the values won't show up.

def display(self):    
        sqlC = self.databaseConn()
        #self.playersList = []
        self.pointlist = []
        self.total = 0
        self.economic_rate=0 
        if "----SELECT TEAM----" == self.CB1.currentText():
            self.msgbox("Warning","Select a team to evaluate")
        else:    
            for x in range(self.LW1.count()):
                player=self.LW1.item(x).text()
                #print(player)
                sqlC.execute("SELECT Scored,Faced,Fours,Sixes,Bowled,Wkts,Catches,Stumping,RO,Given FROM Match WHERE Player = ?",(player,))
                score=sqlC.fetchall()
                points = FantasyCricket.FantasyCricket.BattingBowlingPoints.batting(score)
                points += FantasyCricket.FantasyCricket.BattingBowlingPoints.bowling(score)
                self.pointlist.append(points)
                
                
                #print(points)
                self.total += points
                #print(self.total)
                self.LW2.addItem(str(points))
        self.lineEdit.setText(str(self.total))

P.S- the values are displayed correctly on the Shell using print()

0

There are 0 best solutions below