I'm trying to run a Windows executable inside my application written in Python using PyQt5. I'm fairly new to using PyQt5 but trying.
The problem I'm facing is actually getting the EXE in question to run within my applications Frame, Window or QWidget.
At the moment I don't need to send or get responses/results to and from the Windows executable, I only need the ability to show it within my application.
class MyWindow(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
# create a process
exePath = "C:\\Windows\\system32\\calc.exe"
# subprocess.Popen(exePath)
os.system(exePath)
hwnd = win32gui.FindWindow(0,"Calculator")
print(hwnd)
time.sleep(0.05)
window = QtGui.QWindow.fromWinId(hwnd)
self.createWindowContainer(window, self)
self.setGeometry(500, 500, 450, 400)
self.setWindowTitle('File dialog')
self.show()
def main():
app = QApplication(sys.argv)
w = MyWindow()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
What I get from the following Code is this: