Calling a QT Button (C++) From the External Python Script
-
I am working on a project that is mainly written on Python, but the part where the camera captures are being processed is in a QT project (C++).
For ex:
There is astart
button in the QT which activates several functions that are written in C++:in main.qml:
Button { id: startbutton x: 910 y: 822 text: qsTr("Start") onPressed: { VideoStreamer.startcapturing() } }
For now, I am clicking on this button manually, but I need to write a function that activates this button whenever it is needed in the Python algorithm.
--> So the Python script should call the start button somehow.
I've read about pipes but I couldn't implement anything, actually I don't even know whether I should focus on the communication between QT and Python or C++ and Python.
Please explain it through some example codes using the above code piece, not just ideas. Because I've already read tons of things but I am too noob to apply them.
Notes:
OS: Ubuntu 18.04.6 LTSAll the projects are in the same PC.
-
Hi and welcome to devnet,
Qt is a C++ framework. From what you wrote your QtQuick GUI calls a C++ backend so the question is: do you really need the GUI to run when using your Python script ?
You also have the option of implementing your code with PySide2/6 or PyQt5/6 if your main logic lies in Python.