# Write python bindings

**URL:** https://discourse.slicer.org/t/write-python-bindings/18066
**Category:** Development
**Created:** [June 10, 2021, 4:32pm UTC](https://discourse.slicer.org/t/write-python-bindings/18066 "2021-06-10T16:32:30Z")
**Posts on this page:** 3
**Page:** 2

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [July 20, 2021, 12:07am UTC](https://discourse.slicer.org/t/write-python-bindings/18066/21 "2021-07-20T00:07:21Z")

</div>

PythonQt does not know anything about VTK either and it just works fine. See some more information [here](https://mevislab.github.io/pythonqt/Developer.html) (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](https://github.com/MeVisLab/pythonqt/issues).

---

<div class="post-metadata">

### Author: ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)
#### Post date: [July 20, 2021, 4:54pm UTC](https://discourse.slicer.org/t/write-python-bindings/18066/22 "2021-07-20T16:54:50Z")

</div>

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:

```cpp
  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?

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [July 20, 2021, 7:35pm UTC](https://discourse.slicer.org/t/write-python-bindings/18066/23 "2021-07-20T19:35:37Z")

</div>

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.

[Previous page](https://discourse.slicer.org/t/write-python-bindings/18066.md?page=1)
