This is my main_script.py I want to show a window(splash) for 2 seconds & then open the main window. The splash window shows up & also waits 2 seconds then open the main window. But, the contents of the splash window are not loading.
I am struggling to understand how to manage the classes.
import time
from PyQt5 import QtCore, QtWidgets, uic
from MainWindow import Ui_MainWindow
from SplashWindow import Ui_SplashWindow
class SplashWindow(QtWidgets.QMainWindow, Ui_SplashWindow):
def __init__(self, *args, **kwargs):
super(SplashWindow, self).__init__(*args, **kwargs)
self.setWindowFlags(QtCore.Qt.CustomizeWindowHint) # hide window titlebar
self.setupUi(self)
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.setupUi(self)
self.showSplash()
def showSplash(self):
splash = SplashWindow()
splash.show()
time.sleep(2)
splash.hide()
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
main = MainWindow()
main.show()
sys.exit(app.exec_())```