F
F
FIRSTNAME LASTNAME2019-10-09 12:55:53
Python
FIRSTNAME LASTNAME, 2019-10-09 12:55:53

How do you know that the main window is ready to be launched?

There is a GUI application code in PyQt5. I had an idea to create a splashscreen that would appear when the application starts and disappear when the main window from the function is start_GUI_process()ready to be launched. I put the splashscreen itself in start_splash_screen_process(). The question arises: how to determine that the window is ready? And does it make sense to use multithreading?

def start_splash_screen_process(self):
        self.splash = QSplashScreen()
        self.splash.setFixedSize(400, 200)
        self.splash_pixmap = QPixmap('splash.jpg')
        self.splash.setPixmap(self.splash_pixmap)
        self.splash.show()


    def start_GUI_process(self):
        self.root_window = QMainWindow()
        self.root_window.setWindowTitle('''Mint Player''')
        self.root_window.setFixedSize(400, 200)
        self.root_window.setWindowIcon(QIcon('''headphone.ico'''))
        self.bg = QPixmap('bg.png')
        self.bg_lbl = QLabel(self.root_window)
        self.bg_lbl.setPixmap(self.bg)
        self.bg_lbl.resize(400, 200)

...
if __name__ == '__main__':
    app = QApplication(sys.argv)
    player = Player()
    player.start_splash_screen_process()
    player.start_GUI_process()
    sys.exit(app.exec_())

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question