Menu

Wrapping cpp class into python by using PythonQt Generator

Help
Edvard
2018-04-05
2018-04-08
  • Edvard

    Edvard - 2018-04-05

    Hi every body
    I had written simple class in c++ and I want to port it in python. For this I want use PythonQt Generator tool. How can I do it? My class is something like this:
    Class MathClass{
    Public:
    MathClass(){}
    int sum(int a, intb){return a+b;}
    int sub(int a, intb){return a-b;}
    };
    Is it possible to wrap it by PythonQt generator tool or not and how?
    I should mention that i had witten simple xml for my class but it does not work at all and i don't know what is my problem. i want simple example for doing this.
    thanks for helping

     
  • Florian Link

    Florian Link - 2018-04-06

    Yes, that is possible but not well documented, since it not the main feature of PythonQt.
    It was discussed in this thread: https://sourceforge.net/p/pythonqt/discussion/631392/thread/d753683f/

    You can also just make your class a QObject with slots and properies and use it without a wrapper (have a look at the example directory). Or you can program your wrappers manually , as seen 8n the examples.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.