I
I
idkiberlord0772022-01-06 16:40:19
PyQt
idkiberlord077, 2022-01-06 16:40:19

How to create a separate class from pyqt elements and instantiate its objects in the main interface?

I created a form in qtDesinger and try to split the elements into classes, so that when I click on certain components, I create them?
61d6ef79b76dd062462971.png
as shown in the example, I tried to cut the code and paste it into a separate class.
Then I wrote a method

def addAnswerItem():
        Ui_Answer(MainWindow)

And he tried to call:
ui.add_button.clicked.connect(addAnswerItem)
As you understand, it did not work.

The idea is to destructure in order to add or remove dynamically whole blocks from the form later.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question