# Creating wxVTKRenderWindowInteractor fails on Ubuntu 24.04.1

**URL:** https://discourse.vtk.org/t/creating-wxvtkrenderwindowinteractor-fails-on-ubuntu-24-04-1/16314
**Category:** Support
**Created:** [March 4, 2026, 12:58pm UTC](https://discourse.vtk.org/t/creating-wxvtkrenderwindowinteractor-fails-on-ubuntu-24-04-1/16314 "2026-03-04T12:58:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jkr](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@jkr](https://discourse.vtk.org/u/jkr)
#### Post date: [March 4, 2026, 12:58pm UTC](https://discourse.vtk.org/t/creating-wxvtkrenderwindowinteractor-fails-on-ubuntu-24-04-1/16314/1 "2026-03-04T12:58:12Z")

</div>

Hi, creating a wxVTKRenderWindowInteractor fails with `NotImplementedError` and `SystemError: <slot wrapper ' __init__' of 'sip.simplewrapper' objects> returned a result with an exception set` .

This happens on a second computer running Ubuntu 24.04.1, its working fine on 22.04.1. This might also be due to some other issue, the only difference I can make out at the moment is the different ubuntu version.

Example code:

```auto
import wx
import vtk
from vtkmodules.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor

class MyFrame(wx.Frame):
    def __init__ (self, parent):
        super(). __init__ (parent, title="wxVTK Example", size=(800, 600))

        panel = wx.Panel(self)

        self.vtk_widget = wxVTKRenderWindowInteractor(panel, -1) # This fails

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.vtk_widget, 1, wx.EXPAND)
        panel.SetSizer(sizer)

        renderer = vtk.vtkRenderer()
        self.vtk_widget.GetRenderWindow().AddRenderer(renderer)

        interactor = self.vtk_widget.GetRenderWindow().GetInteractor()

        sphere = vtk.vtkSphereSource()
        sphere.SetRadius(1.0)

        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputConnection(sphere.GetOutputPort())

        actor = vtk.vtkActor()
        actor.SetMapper(mapper)

        renderer.AddActor(actor)
        renderer.ResetCamera()

        self.vtk_widget.Enable(1)
        self.vtk_widget.Initialize()

if __name__ == " __main__":
    app = wx.App()
    frame = MyFrame(None)
    frame.Show()
    app.MainLoop()

```

This fails with the following stack trace:

```auto
NotImplementedError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/developer/3d-medical-imaging/wx_test.py", line 41, in <module>
    frame = MyFrame(None)
            ^^^^^^^^^^^^^
  File "/home/user/developer/3d-medical-imaging/wx_test.py", line 12, in __init__
    self.vtk_widget = wxVTKRenderWindowInteractor(panel, -1) # This fails
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/developer/3d-medical-imaging/venv/lib/python3.11/site-packages/vtkmodules/wx/wxVTKRenderWindowInteractor.py", line 167, in __init__
    baseClass. __init__ (self, parent, ID, pos=position, size=size,
SystemError: <slot wrapper ' __init__' of 'sip.simplewrapper' objects> returned a result with an exception set

```

Specs on machine where it doesn’t work:

```auto
python 3.11.14
24.04.1-Ubuntu
vtk==9.5.2
wx==4.2.5
OpenGL version string: 4.6 (Compatibility Profile) Mesa 25.2.8-0ubuntu0.24.04.1
$XDG_SESSION_TYPE = x11 (originally on wayland but also didn't work)

```

Spec on machine where it does work:

```auto
python 3.11.13
22.04.1-Ubuntu
vtk==9.5.2
wx==4.2.3
OpenGL version string: 4.6 (Compatibility Profile) Mesa 22.04.3-1ubuntu3.1-22.04.1
$XDG_SESSION_TYPE = wayland

```

Maybe I’m having driver issues? I don’t really know how to track down the not implemented thing.. I guess some parameter combination doesn’t work for some reason.

Thanks for your advice!

---

<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: [March 4, 2026, 5:38pm UTC](https://discourse.vtk.org/t/creating-wxvtkrenderwindowinteractor-fails-on-ubuntu-24-04-1/16314/2 "2026-03-04T17:38:04Z")

</div>

Since the `wx.Frame` ` __init__ ` method is what raises the exception, you can try removing or commenting out the line that calls that method to see what the effect is:

```diff
 class MyFrame(wx.Frame):
     def __init__ (self, parent):
- super(). __init__ (parent, title="wxVTK Example", size=(800, 600))
+ #super(). __init__ (parent, title="wxVTK Example", size=(800, 600))

```

I don’t think this is a driver issue, but it might be the result of a change in the version of gtk that wx uses. What versions of gtk are installed on these two machines? Whats the status of support for x11 for the versions of gtk that are installed?

---

<div class="post-metadata">

### Author: ![jkr](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/258eb7/32.png) [@jkr](https://discourse.vtk.org/u/jkr)
#### Post date: [March 5, 2026, 8:04am UTC](https://discourse.vtk.org/t/creating-wxvtkrenderwindowinteractor-fails-on-ubuntu-24-04-1/16314/3 "2026-03-05T08:04:45Z")

</div>

Thanks for your reply!

Working: libgtk-3-dev:amd64 3.24.33-1ubuntu2.2  
Not working: libgtk-3-dev:amd64 3.24.41-4ubuntu1.3

I’m not exactly sure what you mean by status of X11 support… Running `GDK_BACKEND=x11 gtk3-demo` works fine.

Could there be any other packages/libraries I would need to check for version mismatches?

The exception is raised by `self.vtk_widget = wxVTKRenderWindowInteractor(panel, -1)`. More specifically by this:

```auto
baseClass. __init__ (self, parent, ID, pos=position, size=size,
                                   style=style,
                                   attribList=attribList)

```

The `super(). __init__ ()` call is required. I tried to do `wxVTKRenderWindowInteractor(self, -1)` but it results in the same error.

---

<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: [March 5, 2026, 4:09pm UTC](https://discourse.vtk.org/t/creating-wxvtkrenderwindowinteractor-fails-on-ubuntu-24-04-1/16314/4 "2026-03-05T16:09:07Z")

</div>

Hmm, yeah, they’re both gtk 3.24 so I wouldn’t expect differences in behavior. You’re right about `super(). __init__ ()`, I was misreading the stack trace.

If gtk works with GDK\_BACKEND=x11, then I would expect it to work fine with VTK 9.5, which is also x11. However you can’t trust me 100% on that, it’s been ages since I did any gtk programming. Have you tried setting GDK\_BACKEND=x11 before running your code?

The `baseClass` stuff is at line 47 in wxVTKRenderWindowInteractor.py:

```python
baseClass = wx.Window
if wx.Platform == " __WXGTK__":
    import wx.glcanvas
    baseClass = wx.glcanvas.GLCanvas

```

This `if` statement was added to the code 20 yrs ago, so I don’t know if GLCanvas is still the best base class to use.
