You can run a separate eventloop using QEventLoop before calling QApplication :: exec (). You must emit a "ready" signal from your class and connect it to the quit () slot of QEventLoop or use the existing signal provided in the Qt class that you are using.
Here is a simple example of getting a web page using QNetworkAccessManager:
app = QtCore.QCoreApplication([])
manager = QtNetwork.QNetworkAccessManager()
req = QtNetwork.QNetworkRequest(QtCore.QUrl("http://www.google.com"))
resp = manager.get(req)
eventloop = QtCore.QEventLoop()
eventloop.connect(resp, QtCore.SIGNAL('finished()'), QtCore.SLOT('quit()'))
eventloop.exec_()
print resp.readAll()
app.exec_()
As long as this can satisfy your needs, I could not understand why you cannot just do everything that you have before calling show () in your window, once that is done, call show ().
source
share