Richard Terry wrote:
I don;'t suppose you'd have a few lines of sample code?
I first read that as "simple code" and was about to make some smart remark about the words "simple" and "grid" not belonging in the same sentence.
Here's a snip from something I'm working on right now.
路路路
#===============================================================================
# A class for displaying a data list in a grid
#===============================================================================
import wx.grid as gridlib
class ListGrid(gridlib.Grid):
def __init__(self, parent):
gridlib.Grid.__init__(self, parent, -1, style=0)
# You first have to create a grid. Never understood this.
# You would have thought we'd already done that when we
# instantiated this monster.
self.CreateGrid(0, 5) # Give it five columns
# Get a renderer for cell wrapping
wrapCell = gridlib.GridCellAutoWrapStringRenderer()
# The column I want to wrap
wc = 0
# Get a grid cell attribute that we can hack on
attr = gridlib.GridCellAttr()
# Set the attribute to have a wrapping renderer
attr.SetRenderer(wrapCell) # Set it to cell wrap text
# Set our column of choice to use those attributes
self.SetColAttr(wc, attr)
This just shows how to set a column to wrap, it doesn't show any of the details of loading the grid and setting column headers, etc. Hope this is of some small help.
Grids aren't simple but there's little that can't be done with them in the realm of anything tabular.
Michael