[PyQt] Large Table Example in PyQt4

David Boddie david at boddie.org.uk
Sat Dec 22 02:25:52 GMT 2007


On Thu, 20 Dec 2007 16:20:08 -0800 (PST), 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

The model looks OK to me. I don't think it's doing anything special that
would cause it to be inefficient.

> 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 paradigms for "item views" are different in Qt 3 and Qt 4. I don't think
a solution for PyQt3 will help you much.

> 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.  

It would be interesting if you could run a profiler on your code so that we
can see where the bottlenecks are. I recommend using qPyProfiler for this:

  http://www.digitalfox.org/projets/qPyProfiler/

It will be interesting to see where most of the CPU time is being spent.

David




More information about the PyQt mailing list