D
D
Danil2019-08-09 07:31:28
Python
Danil, 2019-08-09 07:31:28

How to convert ui to py and then import?

I have 5 ui files and code that works with them. Now I need to convert py to exe. I decided to use pyinstaller as always, but he wants to see ui-files in the same folder with the program.
Googled , I saw that you need to initially convert files from ui to py. I did this, but how do I add them to the program further? In terms of:

import myapp_win1
import myapp_win2
import myapp_win3
import myapp_win4
import myapp_win5

It doesn’t work like that)
And what should I change this moment for in this case: Please explain how to correctly implement all this and assemble this project. Thank you.
win1 = uic.loadUi("myapp_win1.ui")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-08-09
@flabot

You import the py-file
In the class, it is first inherited, and then the file with the design is initialized:

class mywindow(mydesign.Ui_MainWindow, QtWidgets.QMainWindow):
    def __init__(self):
        super(mywindow, self).__init__()
        self.setupUi(self)  # initialize design from import file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question