How can i embed an app window into a pyqt5 GUI using its windows handle? I have gotten to the point where i can get the handle of the window, but trying to embed it causes the script to crash with no error code before the GUI window is created
_driver = webdriver.Firefox()
my_dict = _driver.capabilities
PID = my_dict['moz:processID']
hwnd = win32gui.FindWindow('notepad', None)
(hwnd is the handle). Here is the code I use to embed the app, it stops working at the line
window = QWindow.fromWinId(hwnd)
class Browser(QWindow):
def __init__(self):
print("making app")
window = QWindow.fromWinId(hwnd)
widget = QtWidgets.createWindowContainer(window)
widget.setParent(self)
layout = QVBoxLayout(self)
layout.addWidget(widget)
self.setLayout(layout)
self.setFixedSize(1000, 1000)
Here is how I call the app:
if __name__ == "__main__":
main = Browser()
app = QApplication(sys.argv)
_window = QWindow()
_window.show()
sys.exit(app.exec_())