Using python as backend
-
I have downloaded QT Creator ofline installer for windows. And I found many demo examples there. All were in C++. Can I use those demo in python? If so, what are the process? I searched a lot about this but found solution. I am mainly interested in example in "Examples\4.7\declarative\keyinteraction\focus".
I usually use QT designer that comes with linux distro. I was just checking for windows version and found many examples.
So anyone out there to help me using those examples with python?
Thanks
-
Hi,
I'd propose starting from here:
http://qt-project.org/wiki/PySideDocumentation/ -
First of all, you can only use Python as a front end to the Qt C++ API backend. It is just terminology, but I feel like it is important to get it straight. The backend is always the "closer to hardware", more powerful and complex side, which in that case is the native C++ api, and the frontend in that case is Python which is much slower and inefficient, making it better by using a wrapper to the Qt C++ backend, which is way faster than Python code, even if it is compiled to binary instead of interpreted as usual. In short, you use the frontend to access and use the backend through it.
About your question - NO. You could see how the demo apps are written and you may try to clone the code logic in Python using the wrapper. The examples are ready to use demo applications, how and why would you want to use them with Python? It is the Qt API libraries that you will want to use.
http://www.pyside.org/ probably has all the resources you will need, downloads, documentation, tutorials, examples and so forth. Keep in mind that using Qt through the Python wrapper is somewhat limited and suboptimal compared to C++.
-
I wouldn't call it suboptimal or limited. At least not without having some data to point to... Besides by using python you have not only the Qt libraries but also Python's own modules at your disposal. That is a powerfull combination and let's you do some pretty funky stuff with minimal effort. I've found it most usefull for doing on-device prototyping (python + qml).
-
Are you really suggesting that Python has no performance and efficiency penalties, and no flexibility loss when using Qt through a wrapper compared to native C++? I just mentioned what is a commonly known fact, as I considered the OP might be interested in it, there is really no need to rush to Python's defense, C++ vs Python is not the topic of discussion.
-
timoph, thanks for your response, now I have something to begin with.
ddriver, yes my post title has mistake in it, I just wanted to say backend as coding the logic and QT GUI as front end, which was actually wrong to say it. And you may be correct about performance and efficiency using python in Qt. But I want in that way. I want to use python (as personally I don't prefer C/C++. Though they are powerful in many cases they are very hard to use and we should take much care while programming)
anyway thanks both of you.