# python vtk: how to import QVTKOpenGLNativeWidget

**URL:** https://discourse.vtk.org/t/python-vtk-how-to-import-qvtkopenglnativewidget/7641
**Category:** Support
**Created:** [January 14, 2022, 10:15am UTC](https://discourse.vtk.org/t/python-vtk-how-to-import-qvtkopenglnativewidget/7641 "2022-01-14T10:15:46Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [January 14, 2022, 10:15am UTC](https://discourse.vtk.org/t/python-vtk-how-to-import-qvtkopenglnativewidget/7641/1 "2022-01-14T10:15:46Z")

</div>

I am using python based vtk, and I want to import QVTKOpenGLNativeWidget, but an error is reported:

```auto

AttributeError: module 'vtkmodules.all' has no attribute 'QVTKOpenGLNativeWidget'

```

How can I import `QVTKOpenGLNativeWidget`? Is it necessary to compile vtk from source code and then generate python module?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [January 22, 2022, 4:13pm UTC](https://discourse.vtk.org/t/python-vtk-how-to-import-qvtkopenglnativewidget/7641/2 "2022-01-22T16:13:04Z")

</div>

I don’t think that class is wrapped in Python.

Cc: @mwestphal @dgobbi

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [January 22, 2022, 6:06pm UTC](https://discourse.vtk.org/t/python-vtk-how-to-import-qvtkopenglnativewidget/7641/3 "2022-01-22T18:06:41Z")

</div>

I dont think it is either.

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [January 23, 2022, 3:22am UTC](https://discourse.vtk.org/t/python-vtk-how-to-import-qvtkopenglnativewidget/7641/4 "2022-01-23T03:22:35Z")

</div>

Just curious, why don’t wrap it in python?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [January 23, 2022, 1:12pm UTC](https://discourse.vtk.org/t/python-vtk-how-to-import-qvtkopenglnativewidget/7641/5 "2022-01-23T13:12:15Z")

</div>

It is not a `vtkObjectBase` and the wrappers only understand how to wrap it and its subclasses. I suppose it could be wrapped with whatever Qt uses (it is a `QObject`), but that has not been implemented.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [January 23, 2022, 1:36pm UTC](https://discourse.vtk.org/t/python-vtk-how-to-import-qvtkopenglnativewidget/7641/6 "2022-01-23T13:36:47Z")

</div>

Exactly. In order to be used in Python, `QVTKOpenGLNativeWidget` would have to be wrapped with PyQt/sip and PySide/shiboken. In other words, wrapping this class is very different from wrapping other VTK classes, and it would require a lot of work.

That’s why people use `QVTKRenderWindowInteractor.py` instead. It is a pure Python class that doesn’t require `QVTKOpenGLNativeWidget`. Please see the [example.](https://gist.github.com/dgobbi/bfdb149e38777f25d0891c1b883858e2)
