Can we use python in qt?



  • Can we use python in qt? from what I know qt using c++, but i heard about pyQT or something like that, but i don't know what is that, different version of qt?

    I want use python in qt, what should i do, what I must to download?
    Thanks :)



  • Hi! Qt is a set of libraries written in C++. It's easy to use these libraries in an application when that application is written in C++, too. Applications written in Python can not directly use C++ libraries. Thus you can not use the Qt libraries directly in a Python application. But it's possible to write code that extends the Python run-time with custom modules. These extensions can use C++ libraries internally. PyQt is a set of Python modules that act as Python wrappers of the Qt C++ libraries. This is called a language binding. PyQt is not part of the Qt Project, but a separate product by Riverbank. For more info on PyQt see their website.



  • @Niconi
    Further to @Wieland, and just so you know, I use PyQt from Python and it's fine and comprehensive. You will get 99.9% of the Qt C++ functions/types etc. available to you.

    The only thing you have to bear in mind is most examples & help for Qt will show C++, you have to be prepared to do a little logical thinking when adapting to PyQt at times.

    Also, if you are going to develop in Python (including with Qt & PyQt) I strongly recommend you use PyCharm (https://www.jetbrains.com/pycharm/) as your IDE.


  • administrators

    Hi! There is also the PySide 2 project https://wiki.qt.io/PySide2
    It is about bringing the old PySide project that worked with Qt4 up to date to Qt5.
    It's not completely ready, but worth following, as it is part of the Qt project.



  • @tekojo
    One has to make a firm decision as to whether to go down the PyQt or the PySide(2) route, once and for all.

    I would have welcomed using the solution which is part of the Qt project. However, it is consistently so woefully behind PyQt and the current version of Qt (in that it has many classes etc. missing) that I cannot see why anyone would want to muddy the waters by suggesting it as an alternative?

    [EDIT: Oh maybe if you have to use LGPL, that's all I can think of? But then be careful as many parts of Qt are not interfaced. What I don't understand is that it's supposed to properly "supported" by Qt (as per the link, right?), but it clearly is not decently maintained, so why bother?]


  • administrators

    @JNBarchan it's being worked on. Getting something like that back up to date takes time. It was left behind for a long time.
    I mentioned it, as it will at some point be an option.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.