Search code examples
pythonwxpythonwxwidgetsscrolledwindow

How do I get the dimensions of the view (not obstructed by scrollbars) in a wx.ScrolledWindow?


Is there an easy way to do this? Alternatively, if I could get the width of the scrollbars, I could just use the dimensions of the ScrolledWindow and subtract them out myself...


Solution

  • Use wx.SystemSettings.GetMetric() with wx.SYS_HSCROLL_Y and wx.SYS_VSCROLL_X to get the scrollbar sizes. Then use window.GetClientSize() and subtract it out.

    http://docs.wxwidgets.org/stable/wx_wxsystemsettings.html#wxsystemsettings

    >>> wx.SystemSettings.GetMetric(wx.SYS_HSCROLL_Y)
    16
    >>> wx.SystemSettings.GetMetric(wx.SYS_VSCROLL_X)
    16