Skip to content Skip to sidebar Skip to footer

Splash Screen In Pyqt

I want to modify my code to add the splash screen before login dialog is shown(about 2 seconds) .i tried something(changed into comment )but not working .please show me how to modi

Solution 1:

Use a timer to start the login procedure:

if __name__ == '__main__':

    app = QtGui.QApplication(sys.argv)

    splash_pix = QtGui.QPixmap('logo and typeface blue.jpg')
    splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
    splash.show()

    def login():
        splash.close()
        if Login().exec_() == QtGui.QDialog.Accepted:
            global window
            window = Main_Window()
            window.show()
        else:
            app.quit()

    QtCore.QTimer.singleShot(2000, login)

    sys.exit(app.exec_())

Post a Comment for "Splash Screen In Pyqt"