Unsolved Is there have relationship between QWidget and QWindow after QWindow detach from QWidget?
-
The environment:
Python 3.6.8
PyQt 5.7.1
pywin32-224-cp36-cp36m-win_amd64 -
Hi,
@richie18 said in Is there have relationship between QWidget and QWindow after QWindow pop up?:
Block the application A by manual.
What do you mean by that ?
-
@SGaist said in Is there have relationship between QWidget and QWindow after QWindow pop up?:
lock the application A by manua
Block the application A's process after application A pop up from application B. For example, run code in application A below:
import time while True: print(time.time())
-
Use code below as application A.
When application A is poped up, click the 'block process' button in applicaiton A. Then application B's process is also blocked.# -*- coding: utf-8 -*- import sys from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QPushButton class MyWidget(QWidget): def __init__(self, parent=None): super(MyWidget, self).__init__(parent) self.setWindowTitle("block application") layout = QVBoxLayout(self) blockBtn = QPushButton("block process") layout.addWidget(blockBtn) blockBtn.clicked.connect(self.block) self.resize(300, 200) def block(self): import time while True: print(time.time()) if __name__ == '__main__': app = QApplication(sys.argv) widget = MyWidget() widget.show() app.exec_()
-
Intriguing... Out of curiosity, what is the use case of "blocking" the application ?
-
Maybe I am not expressing correctly.
“blocking” Means that application cannot respond to mouse operationsMay be follow the steps below to make it clear.
Steps:
- Start application A.
- Start application B.
- Click embed button in application B. Embed the application A to application B.
- Click popup button. Popup the application A.
- Click block button in application A. Application A run Infinite loop, can not respond to mouse operations.
- Application B's process also cannot respond to mouse operations.
-
I would try to check with the event dispatchers if you can find something there.
-
Application A's block() add code processEvents(), it seems ok. But native windows cannot be handled this way.
So, I'm not sure relationship between two application when they are detached. And how to solve?def block(self): import time while True: print(time.time()) QApplication.processEvents()
-
You should check the the win32gui module developer, he may have some insight as to what is happening.
-
I'm not use win32gui.setParent(), also has this problem.
-
As already suggested, contact the module author.