Execution order

D

DarkBlue

Here is some code from a pyqt4.5.4 application on python 2.6

def findData(self):

self.ui.label.setText('Processing... ')

# here we do something which takes a few seconds
self.refreshGrid()



The problem is that the text in the self.ui.label is only changed
on screen after the self.refreshGrid() has finished executing
rather than before.

How do I achieve the expected result ?

Thanks
Db
 
D

Diez B. Roggisch

DarkBlue said:
Here is some code from a pyqt4.5.4 application on python 2.6

def findData(self):

self.ui.label.setText('Processing... ')

# here we do something which takes a few seconds
self.refreshGrid()



The problem is that the text in the self.ui.label is only changed
on screen after the self.refreshGrid() has finished executing
rather than before.

How do I achieve the expected result ?

You can make Qt process all pending events once, via
QCoreApplication.processEvents.

This should trigger the redraw.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top