Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using PySide within a python plugin in a non-Qt environment
Frime last edited by Frime
I have already some experience with Qt in the C++ context but I'm a total beginner when it comes to Python. What I actually want to do is to write a python Plugin for Octoprint using PySide. Octoprint does not use Qt which means there is no QApplication instance running so far.
My question is now: Do I need to start an extra thread for the app.exec_() call? Or are there any alternatives / best practices how to start QApplications from an external plugin in a non Qt environment? Thanks in advance!
Do I need to start an extra thread for the app.exec_() call?
exec()blocks the calling thread permanently until you shut down Qt.
I'm not familiar with how Octoprint loads and runs plugins. But if it runs your plugin script in the same thread as the core program, then yes you need to create an extra thread to call
exec()and all other Qt GUI functions.