GridStringTable - is it a derived class of GridTableBase or not?

I’m trying to mess with the attributes of my Grid; I think that requires me to call GetAttr() on the GridTableBase associated with my Grid. But GetTable() isn’t returning a GridTableBase, it’s returning a GridStringTable, and that’s where things get weird:

  • wxWidgets definitely says GridStringTable descends from GridTableBase: here
  • wxPython implies GridStringTable does NOT descend from GridTableBase or anything else: here
  • My code is throwing an exception; my GetTable() is returning a GridStringTable, and GridStringTable does not have a GetAttr() function (so GridStringTable must not descend from GridTableBase)

What am I missing?!

wxPython implies GridStringTable does NOT descend from GridTableBase

true… it’s a glitch in the docs I’m afraid

StringTable is a subclass of TableBase though:

>>> import wx
>>> wx.version()
'4.0.6 msw (phoenix) wxWidgets 3.0.5'
>>> import wx.grid
>>> wx.grid.GridStringTable.__mro__
(<class 'wx._grid.GridStringTable'>, <class 'wx._grid.GridTableBase'>, <class 'wx._core.Object'>, <class 'sip.wrapper'>, <class 'sip.simplewrapper'>, <class 'object'>)
>>> wx.grid.GridStringTable.GetAttr
<built-in function GetAttr>
1 Like