On Tuesday, April 23, 2013 11:22:29 PM UTC-7, Sara Lochtie wrote:
> I have written a GUI that gets data sent to it in real time and this data is 
> displayed in a table. Every time data is sent in it is displayed in the table 
> in a new row. My problem is that I would like to have the data just replace 
> the old in the first row.
> 
> 
> 
> The table has 6 columns (A, B, C, D, E, F) I want the new data to continue 
> replacing the old data in the same row unless the data that goes under column 
> A changes, at which point a new row would be added.
> 
> 
> 
> Does anyone have tips on how to approach this? I can post a portion of my 
> code to get a better idea of what I have done.

So that is where I am stuck. I don't how to compare them and I am trying to 
avoiding saving the data to a file.  

This is the code that I have:





if msg.arg2() != ERROR:
                        entry = (A, B, C, D, E, F)         
                        self.data.append(entry) 
                    
        data = self.data                                                 
    
        # Display how many runs occurred
        self.statusBar().showMessage('Data read. %s Run(s) Occurred.' % 
self.runCount)
        
        # Populates table by adding only new entries to the end of the table
        lastRow = self.table.rowCount()
        self.table.setRowCount(len(data))
        for entryPos in range(lastRow, len(data)):         
            for fieldPos in range(6):                                       
                item = QtGui.QTableWidgetItem(str(data[entryPos][fieldPos]))
                self.table.setItem(entryPos, fieldPos, item)
        self.table.resizeColumnsToContents()
        self.table.horizontalHeader().setStretchLastSection(True)               
   
        self.currentRunLabel.setText('Current Run: ' + str(self.runCount))
        self.currentLineLabel.setText('Number of lines: ' + str(len(self.data)))
                print('End of %s. run:    %s. entries found' % (self.runCount, 
len(self.data)))
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to