wx.GridSimple: Column Title Row Designation and Grid/Table Relation

19 views
Skip to first unread message

Rich Shepard

unread,
May 23, 2015, 4:40:41 PM5/23/15
to wxpytho...@googlegroups.com
The wxPyWiki page for wx.Grid starts with a discussion of 'table
interactions.' Is the table automagically generated or is it something that
I, as a developer, need to create and manage? What is the relationship
between the table and the grid?

Grid rows that hold user-entered data start with row 0. Above that row is
a row of column titles. How do I reference that title row to increase the
height using SetRowSize(int row, int height)? Some column headings are on
two lines and that row needs a bit more height so there's a blank border
above the titles.

Rich

Rich Shepard

unread,
May 23, 2015, 4:49:59 PM5/23/15
to wxpytho...@googlegroups.com
On Sat, 23 May 2015, Rich Shepard wrote:

> Grid rows that hold user-entered data start with row 0. Above that row is
> a row of column titles. How do I reference that title row to increase the
> height using SetRowSize(int row, int height)? Some column headings are on
> two lines and that row needs a bit more height so there's a blank border
> above the titles.

Addendum:

Toward the bottom of the wx.Grid wiki page is a section on autosizing
labels. After the method the author wrote,

"According to the docs here, as of wxPython version 2.8.8. the following
should auto-size column and row labels. I replaced the code snippet above in
my latest project (a Virtual Grid using wx.2.9.3 on Windows 7) with:

self.SetRowLabelSize(wx.grid.GRID_AUTOSIZE)
self.SetColLabelSize(wx.grid.GRID_AUTOSIZE)"

I'm running wx.Python-3.0.2.0 on Slackware-14.1 and these commands are not
working when placed in a class; e.g.,

class pwAir(wx.Panel):
def __init__(self, *args, **kwds):
wx.Panel.__init__(self, *args, **kwds)

topBox = wx.BoxSizer(wx.VERTICAL)
commentBox = wx.BoxSizer(wx.HORIZONTAL)

dataGrid = gridlib.Grid(self)
self.nRows = 26
self.nCols = 9
self.flag = 0

dataGrid.CreateGrid(self.nRows, self.nCols)
self.SetRowLabelSize(wx.grid.GRID_AUTOSIZE)
self.SetColLabelSize(wx.grid.GRID_AUTOSIZE)

Removing the 'self' after python complains about it does not resolve the
issue.

Should the SetColLableSize() function be located elsewhere in the code to
work or is there another issue to be addressed?

Rich
Reply all
Reply to author
Forward
0 new messages