0

I want to put an .exe file in pyqt which is designed using a Qt designer. I have managed to show a video captured by openCV. However this time the video capturing file is converted to an executable file. I want to run the .exe file and show the output inside the pyqt UI. I have tried using os module in opening an executable file wherein it opens it but it is not inside the created Qlabel widget. Is there a way i can put it inside the UI? Thank you

Update: Ive done research but all i see is Qt in C++

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    QWindow *window = QWindow::fromWinId(125829124);
    QWidget *widget = QWidget::createWindowContainer(window);
    widget->setParent(this);
    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(widget);
    this->setLayout(layout);
}

Ive tried to use this code but still the window is not inside the UI.

class Program(QMainWindow):
def __init__(self):
    super().__init__()
    exePath = "/home/liva/app.exe"
    subprocess.Popen(exePath)
    hwnd = 3800003 #the window id of the app.exe
    self.window = QWindow.fromWinId(hwnd)
    self.setWindowFlags(Qt.FramelessWindowHint)
    self.widget = QWidget.createWindowContainer(self.window,self)
    self.widget.resize(300, 300)
    self.widget.move(400, 300)
    print(self.window.parent())
    layout = QVBoxLayout()

    layout.addWidget(self.widget)
    self.setLayout(layout)

    self.setGeometry(100, 100, 900, 900)
    self.setWindowTitle('UI')
    self.show()
Denlord
  • 25
  • 1
  • 6
  • https://stackoverflow.com/questions/41474647/run-a-foreign-exe-inside-a-python-gui-pyqt like the one here but in pyqt 5 – Denlord Mar 27 '18 at 06:30
  • I got it working now. Just need to correct the window id and get it manually. – Denlord Mar 28 '18 at 05:24

0 Answers0