sebo
sebo

Reputation: 1664

Print status message before exiting a QWidget

Upon exiting a widget which is in a new window, I would like to print a status message in its QTextBrowser. This is because when I exit the window, it calls a function in the main window which takes some time to complete, and the window containing this QTextBrowser remains open for a couple minutes.

I have the following defined inside my QWidget class for the window which gets closed:

def closeEvent(self,e):
    self.browser.append('Please wait while calculations are performed. This may take up to a few minutes...')
    self.main_instance.update_data(self.data)

The update_data() call in my main window gets executed and it takes some time to complete, but the QTextBrowser in the window which gets closed does not get updated.

Please let me know if what I'm trying to achieve is possible, or give me some insight as to why it's not possible.

Upvotes: 0

Views: 64

Answers (1)

hackyday
hackyday

Reputation: 1329

Add a QtGui.QApplication.processEvents() call after you update the QTextBrowser

Upvotes: 1

Related Questions