[Python] PyQ5t: load Qt Designer into Python script (loadUiType): how to check error cause?

Discussão em 'Python' iniciado por Stack, Abril 11, 2025.

  1. Stack

    Stack Membro Participativo

    I design GUI in Qt Designer, then I load UI-file in my Puthon3 script with the loadUiType method:

    class Main(QMainWindow, uic.loadUiType("adc_main_form.ui")[0]):
    def __init__(self):
    super(Main, self).__init__()
    self.setupUi(self)


    All works fine. Then I make a little revolution in my form design and it includes a lot of renaming. So I take that UI-file of Qt Designer (XML file) and edit it in a text editor. Maybe I make some typo mistakes. Now I get a message during the start of Python script, on the line self.setupUi(self):


    File "string", line 671, in setupUi

    TypeError: argument 1 has unexpected type 'QRadioButton'
    ​

    So, some goes wrong in the process of importing the XML file. But the error type tells me not enough to find the error.

    I double check all my QRadioButton widgets. No idea.

    I open Ui with the Designer - it opens without error messages.

    I convert UI into PY (pyiuc5) - no errors.

    The .ui file is here.

    What can be the way to find the error in such a closed process as setupUI?

    Continue reading...

Compartilhe esta Página