I’m hitting an error in some code which has previously worked for me. It’s been a while since I updated to a newer wxPython.
The code is:
def MakeCellVisibleCentered(self, row): cell_coords = self.CellToRect(row, 0) client_size = self.GetGridWindow().GetClientSize() ycoord_pixels = cell_coords.y - (client_size.height / 2) **ycoord = ycoord_pixels / wx.ScrolledWindow.GetScrollPixelsPerUnit(self)** if ycoord < 0: ycoord = 0 wx.ScrolledWindow.Scroll(self, 0, ycoord)
The error is:
TypeError: _ScrolledWindowBase.GetScrollPixelsPerUnit(): first argument of unbound method must have type ‘_ScrolledWindowBase’
In this function, self is a wx.grid.Grid. The documentation seems to say that Grid derives from Scrolled. This code is just trying to force a given row to become visible in the scrolled window. If there’s a better way to do this, I would appreciate knowing that.