On Sat Nov 10 00:03:47 GMT 2007, Vadim Gutnik wrote:

> I'm new to GUIs, but thinking about writing a GUI that is a little bit
> like a simple vector drawing program. So I've been looking at various
> toolkit and language options.
> 
> So far, it looks like my first choice would be PyQt... but it seems
> slow. I wrote the attached code. If you select more than a couple dozen
> shapes and move them, there's substantial lag, and I see python pegging
> the CPU.

I tried your code and can confirm that it's slow. :-(

However, there is a solution to your problem - see below. :-)

> The question: 
> 
> 1) Is there something I'm doing that is seriously inefficient and could
>    be rewritten for speed?

Not at all. It would appear that you've written an example that leaves
pretty much all the processing to the underlying framework.

> 2) What sort of speedup might I expect from this same program if it were
>    rewritten in C++ with qt?

First, I rewrote it in C++, built it against Qt 4.2, and saw the same
performance issues.

Then, I searched the Task Tracker for similar reports to yours and found
this one:

http://trolltech.com/developer/task-tracker/index_html?method=entry&id=144901

So, I built it against Qt 4.3 - still the same problem.

I followed the advice given in the task description. The resulting
performance is _much_ better - you have to see it to believe it. :-)

If you can, you should use PyQt 4.3.1 with Qt 4.3 so that you can take
advantage of the improved performance and configurability of QGraphicsView.

Have fun!

David

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to