GLCanvas: SystemError: <built-in function IsDisplaySupported> returned a result with an exception set

Hi!

I’m having issues with wx.glcanvas.GLCanvas. I originally wanted to create a wxVTKRenderWindowInteractor which failed due to problems that boil down to wxpython’s GLCanvas.

Most notably the GLCanvas.__init__ method, but even glcanvas.GLCanvas.IsDisplaySupported([glcanvas.WX_GL_RGBA]) fail with an error along the lines of SystemError: <built-in function IsDisplaySupported> returned a result with an exception set.

Full stack trace is

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 4, in <module>
    glcanvas.GLCanvas.IsDisplaySupported([glcanvas.WX_GL_RGBA])
SystemError: <built-in function IsDisplaySupported> returned a result with an exception set

My specs are

Linux 6.14.0-37-generic #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC x86_64 GNU/Linux
wxPython 4.2.5 from pypi
Python 3.11.14

I am not able to get any more meaningful debug messages. I tried

XDG_SESSION_TYPE=x11
WXTRACE=glcanvas
WXTRACE=all
WXDEBUG=1
G_MESSAGES_DEBUG=all
GDK_DEBUG=gl
GDK_BACKEND=x11

Maybe the problems are also called by other libraries. But I am unsure about how to approach that.

Thanks for any advice.