A
A
Alexander Rublev2016-03-24 01:20:42
Python
Alexander Rublev, 2016-03-24 01:20:42

How to correctly connect a .ui file to Python?

Guys with experience! Tell me how to correctly connect files from qtdesiner (.ui).
1) Convert it to .py (It's not very convenient to edit the design, but it's not very convenient to code, since widget names are not automatically substituted)
2) Just include .ui (Pros and cons exactly the opposite)
Does connecting .ui really slow down the program?
I'm connecting like this now

app = QApplication(sys.argv)
main_class, base_class = loadUiType('main.ui')  

class MainWindow(QMainWindow, main_class):  
    def __init__(self, *args):
        super(MainWindow, self).__init__(*args)  
        self.setupUi(self)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Che, 2016-03-24
@Meller008

Can be connected directly, can be converted to .py. The main thing is not to edit this file manually. And if you need to redefine something in the design that cannot be edited in qtdesigner, then it is better to do this in the main program file.

N
nirvimel, 2016-03-24
@nirvimel

I use pyuic4. In all recommendations, they also write mainly about this method. About the possibility of direct connection *.uiheard only in one place.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question