0

I want another window for the image file to be opened as soon as the app loads beside the main window.

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from PyQt5.QtGui import QIcon, QPixmap

class App(QWidget): 
    def __init__(self):
        super().__init__()
        self.title = 'LEGO'
        self.left = 10
        self.top = 10
        self.width = 640
        self.height = 480            

    def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
        self.setStyleSheet("background-color: white;")
        self.show()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = App()
    sys.exit(app.exec_())

But I dont know how to display the image file as soon as my main window opens. I want my image window to be also opened just after my main window is loaded. I am new to pyqt5 please help

1 Answers1

0

Try the QSplashScreen Class http://doc.qt.io/qt-5/qsplashscreen.html

The example from the docs is:

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QPixmap pixmap(":/splash.png");
    QSplashScreen splash(pixmap);
    splash.show();
    app.processEvents();
    ...
    QMainWindow window;
    window.show();
    splash.finish(&window);
    return app.exec();
}
James McCorrie
  • 2,283
  • 3
  • 18
  • 22