This question applies to Raspberry Pi 3B+ running Stretch. Python 3.5. The user interface for a Qt5 application is created. If there is some time-consuming setup before app.exec_(), only an empty window frame is visible, instead of the fully rendered window.
This behavior is different from what's seen on MacOs, for example, where the window is, indeed, rendered.
import time
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
# the main GUI window
class App(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('Test')
# create and run the interactive application
if __name__ == '__main__':
app = QApplication(sys.argv)
mainWindow = App() # create the application window
mainWindow.show() # this should show the window
app.processEvents() # everything should be updated
# delay. only an empty window frame is shown.
print ('Delay 10s...')
time.sleep(10)
# enter the GUI loop. now the window is rendered.
sys.exit(app.exec_())
Only an empty window frame is shown. What's expected is a fully rendered window (in this case, it should be just a white empty window but if there are other GUI elements, they should show as well.