I developed a kinda complex UI in Designer and load this in PySide6 using QUiLoader.
It worked during development, but just when I thought I was finished it doesn’t show anything any more. The scripts starts and runs, it just doesn’t show any window any more.
I’m running this on Windows 11, Python 3.12/PySide 6.7.2 and 3.11 with PySide.
I’ll give you a stripped down version with the same behaviour, I really hope you can help me with this:
(the path to HelloWorld.ui is correct, I dbl checked it several times)
from PySide6.QtUiTools import QUiLoader
from PySide6.QtCore import QFile
from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout
class Window(QWidget):
def __init__(self, parent=None):
super().__init__(parent=parent)
loader = QUiLoader()
ui_file = QFile('D:/Path/to/HelloWorld.ui')
ui_file.open(QFile.ReadOnly)
self.window = loader.load(ui_file, self)
root_layout = QVBoxLayout()
root_layout.addWidget(self.window)
self.setLayout(root_layout)
ui_file.close()
app = QApplication.instance()
if not app:
app = QApplication()
window = Window()
window.show()
app.exec()