fail to convert .ui to .py file (PyQt6)

17 Views Asked by At

I've created an ui file using the QT Designer in PyQt6 and recieved the following error: TypeError: ('Wrong base class of toplevel widget', (<class 'main.UI'>, 'QMainWindow'))

after trying to convert (ui to py) the file using the uic library:

from PyQt6.QtWidgets import QApplication, QWidget
from PyQt6 import uic
import sys


class UI(QWidget):
    def __init__(self):
        super().__init__()

        uic.loadUi("tests_window.ui", self)


app = QApplication(sys.argv)
window = UI()
window.show()
sys.exit(app.exec())

Also, recived this error:

CommandNotFoundException

after trying to use "pyuic6 -x input.ui -o output.py" in terminal.

I figure the two cases are related somehow, couldn't find any solution in previous topics and the packages were installed using pip.

Thanks for the help.

0

There are 0 best solutions below