pirateSteel
pirateSteel

Reputation: 37

How to load Qt Designer UI file

import sys
from PyQt5.uic import loadUi
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QDialog, QApplication, QWidget
from PyQt5.QtGui import QPixmap
from PyQt5 import uic


class WelcomeScreen(QDialog):
    def __init__(self):
        super(WelcomeScreen, self).__init__()
        uic.loadUi("welcomescreen.ui",self)

app = QApplication(sys.argv)
welcome = WelcomeScreen()
widget = QtWidgets.QStackedWidget()
widget.addWidget(welcome)
widget.setFixedHeight(800)
widget.setFixedWidth(1200)
widget.show()
try:
    sys.exit(app.exec_())
except:
    print("Exiting")

[Errno 2] No such file or directory: 'welcomescreen.ui'

Can anyone please explain this? I am fairly new to PyQt5 and got stuck in this problem. Your kind help will be appreciated.

Upvotes: 3

Views: 3221

Answers (0)

Related Questions