SetCellHighlightPenWidth problems
A.M.
cuberootva at gmail.com
Wed Aug 30 08:07:31 PDT 2006
Hi all,
I have encountered a weird problem with wx.grid.Grid where cells with
the ReadOnly attribute do not respect the SetCellHighlightPenWidth
setting. Below you will find a test case with a 5x3 Grid with the
first column ReadOnly and all cells have a pen width of 3. You will
notice the first column's pen width remains at 1 pixel while the other
columns actually have a 3 pixel border.
This is running on Windows XP Professional and wxPython 2.6.3.3.
Any suggestions? Also, is it possible to set different pen widths and
colors for individual cells instead of all cells in the grid?
#### BEGIN CODE
import wx
import wx.grid
class TestGrid(wx.grid.Grid):
def __init__(self, parent, size, rows, cols):
wx.grid.Grid.__init__(self, parent, wx.ID_ANY, size=size)
self.CreateGrid(rows, cols)
# set cursor width
self.SetCellHighlightPenWidth(-1)
# set the first column to read only
attr = wx.grid.GridCellAttr()
attr.SetReadOnly(1)
self.SetColAttr(0, attr)
class TestFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(600, 400),
style=wx.DEFAULT_FRAME_STYLE|wx.CENTRE)
csize = self.GetClientSize()
self._panel = wx.Panel(self, wx.ID_ANY, size=csize)
self._sizer = wx.BoxSizer(wx.VERTICAL)
self._panel.SetSizer(self._sizer)
# add grid
grid_size = (csize[0], 300)
grid = TestGrid(self._panel, grid_size, 5, 3)
self._panel.Layout()
self.Center()
self.Show(1)
#-------------------------------------------------------------------------
class App(wx.App):
def __init__(self):
wx.App.__init__(self)
def OnInit(self):
self.SetAppName("Test Case")
TestFrame(None, "Test Case")
return True
#-------------------------------------------------------------------------
if __name__ == "__main__":
app = App()
app.MainLoop()
#### END CODE
More information about the wxpython-users
mailing list