Write python bindings

PythonQt does not know anything about VTK either and it just works fine. See some more information here (CPP wrapping section). You can have a look how it is all set up for VTK in CTK and if you cannot figure out how this all works from VTK’s example then you can ask help from PythonQT developers.

1 Like

One more thing:

As I see only classes that has default constructors (in sense they can be constructed with no arguments passed) are wrapped automatically using WRAP_PYTHONQT.

For example slicer’s qSlicerModulesMenu (from qSlicerBaseQTGUI lib) has two constructors:

  qSlicerModulesMenu(const QString& title, QWidget* parent = nullptr);
  qSlicerModulesMenu(QWidget* parent = nullptr);

but only one (the second one) is available in python.

Is it possible to bind the first constructor as well?

Yes, you just need to create the appropriate methods in the decorator classes. These are not simple things and not easy to find documentation, but there are several examples for these in CTK, that you can copy-paste and adapt to your classes.

1 Like