[PyKDE] PyQt application freezing on long operations

Andreas Pakulat apaku at gmx.de
Mon Jan 22 13:41:57 GMT 2007


On 22.01.07 12:45:07, Carlos Eduardo wrote:
> I created a SQL front end for multiple databases in PyQt, currently it supports
> sqlite and Oracle.
> 
> I have a MDI window that i execute the SQL statements and populate a table in it.
> 
> The problem is that when i run a query that takes too much time to evaluate or
> returns too much rows, my application freezes until the rows are populated into
> the table.
> 
> Is there anything I can do to make the application responsive while the
> operation is in progress? I know that the problem is design related.. and not a
> bug but I have not found any solution for this.

One way is to use a worker-thread to execute the SQL query and fetch the
results, then post events to the gui thread which includes the data that
should be displayed. From this data you then create new rows in the
table.

See the documentation on QThread class for more information.

Andreas

-- 
Be cautious in your daily affairs.




More information about the PyQt mailing list