[wxPython-users] wxGrid and Scrollbars

Mark Erbaugh mark at microenh.com
Tue Feb 5 21:52:56 PST 2008


On Tue, 2008-02-05 at 14:54 -0800, Robin Dunn wrote:
> Mark Erbaugh wrote:
> > I have a grid that uses a grid table to manage the data. When creating
> > the grid, I specify a size of (-1, height) where height is the desired
> > height. My desire is to have the grid display just wide enough to
> > include all the columns with no horizontal scrollbar. However, if the
> > grid needs a vertical scrollbar (because there are too many rows to
> > display in the given height), the width of the vertical scrollbar is not
> > included in the grid width, so the grid displays with a horizontal
> > scrollbar.
> > 
> > Is there a way to have the 'automatic'(i.e. -1) width of the grid
> > include the width of the vertical scrollbar?
> 
> No, but you can probably tweak it yourself.  You can find the width of 
> the scrollbar using wx.SystemSettings.GetMetric.

I found wx.SystemSettings.GetMetric and on my setup (Ubuntu Dapper),
wxPython 2.8.7.1 it always returns 15 for the scrollbar width, but I
find I have to add 17 or 18 to the grid width to make the horizontal
scrollbar disappear. Also, if I change to a theme with large print, the
scrollbar gets about 30 pixels wide, but GetMetric still returns 15.

Mark





More information about the wxpython-users mailing list