You have two large culprits here:

tv.resizeColumnsToContents()

and

for row in xrange(nrows):
            tv.setRowHeight(row, 18)


Both can take a very long period of time.

resizeColumnsToContents is the worst offender as it has to scan every piece of data in your column, determine its size and populate the internal arrays. It is better to have a heuristic for this and set the sizes yourself (look at horizontalHeader() for instance)

For row height, see the QTableView::sizeHintForRow()


On Dec 20, 2007, at 7:20 PM, B Clowers wrote:

I am fairly new to python and programming as a whole and would like to develop a small application capable of plotting simple 2D graphs and also display such data in a table. In my initial assessment of PyQt4 I have been able to load my data into a table but it is terribly slow. I am using a QAbstractTableModel example that I found on the web:

http://iwiwdsmi.blogspot.com/2007/12/pyqt-43-qtableview-qabstracttable-model.html

This has been useful but if I load a large numpy array (5 x 250,000) into this example it is insanely slow. It seems as though there was a "bigtable.py" example for PyQt3 but I cannot seem to port this to version 4. The Qt website also discusses the use of large tables when programming C++ but this is out of my league. Does anyone have a simple solution to this problem or perhaps a quick example that I can insert a numpy array into? Again, I'm pretty new to python but am eager to learn.

Cheers,

Brian

Never miss a thing. Make Yahoo your homepage. _______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

======
Brian Kelley
OpenEye Scientific Software Inc.
American Twine Office Park
222 3rd Street Suite 3120
Cambdridge, MA 02142
+1 617 374-8844
[EMAIL PROTECTED]


_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to