qapplication

How to execute PyQt5 application on a resful call

▼魔方 西西 提交于 2021-02-11 09:58:44
问题 Context: I have a Flask application serving a resource POST /start . The logic to be executed involves a PyQt5 QWebEnginePage loading a URL and returning certain data about it. Problem: When the QApplication is executed (calling app.exec_() ) I get the warning: WARNING: QApplication was not created in the main() thread. and then the error: 2019-07-17 13:06:19.461 Python[56513:5183122] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /BuildRoot/Library/Caches/com.apple.xbs

How to execute PyQt5 application on a resful call

笑着哭i 提交于 2021-02-11 09:58:16
问题 Context: I have a Flask application serving a resource POST /start . The logic to be executed involves a PyQt5 QWebEnginePage loading a URL and returning certain data about it. Problem: When the QApplication is executed (calling app.exec_() ) I get the warning: WARNING: QApplication was not created in the main() thread. and then the error: 2019-07-17 13:06:19.461 Python[56513:5183122] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /BuildRoot/Library/Caches/com.apple.xbs

How to execute PyQt5 application on a resful call

南笙酒味 提交于 2021-02-11 09:56:10
问题 Context: I have a Flask application serving a resource POST /start . The logic to be executed involves a PyQt5 QWebEnginePage loading a URL and returning certain data about it. Problem: When the QApplication is executed (calling app.exec_() ) I get the warning: WARNING: QApplication was not created in the main() thread. and then the error: 2019-07-17 13:06:19.461 Python[56513:5183122] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /BuildRoot/Library/Caches/com.apple.xbs

How to get the current QApplication in pyQt?

落花浮王杯 提交于 2021-01-27 06:44:08
问题 I am trying to get a reference to the current QApplication object with pyQt5, but couldn't find the function. My search about "pyQt get current QApplication" shows results about how to create an QApplication. So my question is: Is there a global QApplication object, and if so how can get a reference to an existing (the current) application. The reason I ask, is that I want to test if a debugging code is running within a Qt GUI application. Then, I'd like to bring up a QMessagebox to show

How to get the current QApplication in pyQt?

独自空忆成欢 提交于 2021-01-27 06:42:27
问题 I am trying to get a reference to the current QApplication object with pyQt5, but couldn't find the function. My search about "pyQt get current QApplication" shows results about how to create an QApplication. So my question is: Is there a global QApplication object, and if so how can get a reference to an existing (the current) application. The reason I ask, is that I want to test if a debugging code is running within a Qt GUI application. Then, I'd like to bring up a QMessagebox to show

How to get the current QApplication in pyQt?

不羁的心 提交于 2021-01-27 06:41:17
问题 I am trying to get a reference to the current QApplication object with pyQt5, but couldn't find the function. My search about "pyQt get current QApplication" shows results about how to create an QApplication. So my question is: Is there a global QApplication object, and if so how can get a reference to an existing (the current) application. The reason I ask, is that I want to test if a debugging code is running within a Qt GUI application. Then, I'd like to bring up a QMessagebox to show

Multiple QApplication instances

不羁岁月 提交于 2020-06-11 05:03:20
问题 I'd like to know what are the implications (problems) of having multiple QApplication / QCoreApplication instances in the same process, and how to solve some issues regarding it. The scenario is as follows: I'd like to make a wrapper on a open source third-party application in order to convert it into an embeddable widget as an optional plugin (the application consists basically on a single QMainWindow -based interface). Such project heavily relies on a QCoreApplication derived class but

qApp versus QApplication.instance()

廉价感情. 提交于 2020-02-17 13:26:38
问题 With PyQt5, both of these return the application object: app = QtWidgets.QApplication.instance() app = QtWidgets.qApp for i in app.arguments()[1:]: ... But why does print(QtWidgets.QApplication.instance() is QtWidgets.qApp) print False ? 回答1: The difference between QtWidgets.QApplication.instance() and QtWidgets.qApp is that the latter is a static module variable that must be created when the module is first imported. This results in the following initially baffling behaviour: >>> from PyQt5

How can I simulate mouse clicks by posting events to the Qt event system?

六月ゝ 毕业季﹏ 提交于 2020-01-15 05:32:47
问题 I would like to do a rudimentary automation test of my Qt application. It records mouse events and writes them to a file (f.e. mousepress(300, 400)). When starting the automation, it reads the coordinates from the file, sends the appropriate mouse events and would do a pixel comparison with a previously saved screenshot. Currently, I have an overlay widget that spans the app and has transparent mouse events. All it does is track the coordinates. When reading the data back in, that overlay

How to restart an QApplication

拥有回忆 提交于 2020-01-15 04:52:07
问题 I need to restart my application when a button is clicked, but I'm having some problems with it. I've tried two methods: Tried this suggestion and it indeed restarts the application, but I get a Gtk_IS_INVISIBLE (widget) error for every widget, and all of them look different in the restarted application, with a very "old" look (similar to TkInter widgets). Is there a way so solve this error? Besides this, the application works fine. I also tried: subprocess.Popen("/home/pi/pywork/pyqt/of2.py"