0

这个问题适用于运行 Stretch 的 Raspberry Pi 3B+。蟒蛇 3.5。为 Qt5 应用程序创建了用户界面。如果在 app.exec_() 之前有一些耗时的设置,则只会看到一个空的窗口框架,而不是完全渲染的窗口。

这种行为与在 MacO 上看到的不同,例如,窗口实际上是在哪里呈现的。

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_())

只显示一个空的窗框。预期的是一个完全渲染的窗口(在这种情况下,它应该只是一个白色的空窗口,但如果有其他 GUI 元素,它们也应该显示出来。

4

0 回答 0